Vidyalelo
JavaScript · Q18

Array And Function

Programming · JavaScript · question 18

Q18

Which of the following is the correct code for invoking a function without this keyword at all, and also too determine whether the strict mode is in effect?

A.
var strict = (function { return this; });
B.
mode strict = (function() { return !this; }());
C.
var strict = (function() { return !this; }());
Answer
D.
mode strict = (function { });

Answer: Option C

Solution

Answer: Option C
Solution:
The above code defines and invokes a function to determine if we’re in strict mode.