1.

Why is this keyword not preferred in JavaScript?(a) Highly memory consuming(b) Functions should access the global objects(c) Functions should not access the global objects(d) Very inefficient to useThis question was posed to me in quiz.I need to ask this question from JavaScript Subsets in portion Classes and Modules in JavaScript of JavaScript

Answer» CORRECT answer is (c) FUNCTIONS should not access the global objects

For explanation I WOULD say: The this keyword is forbidden or RESTRICTED because functions (in non-strict mode) can access the global object through this. Preventing access to the global object is ONE of the key purposes of any sandboxing system.


Discussion

No Comment Found

Related InterviewSolutions