InterviewSolution
| 1. |
Which event occurs when a value is added in an input box in JavaScript? |
|
Answer» JavaScript “this” keyword simply means that whatever scope you are inside, it belongs to that. Now the scope can be a function or and Object. Although, there are some exception to this RULE. We can have “this” in various context. Let’s go through them. “this” in simple function Running the above code will give. There is a special case with strict mode. In strict mode “this” to be undefined , as global object refers to undefined instead of window object. function foo() { 'use strict'; console.log(this); console.log(this === window); } foo();“this” in an object property this is Object itself “this” with constructor function The newly created instance is nothing but an object, because everything in JS is an object. |
|