InterviewSolution
| 1. |
What Will Be The Output Of The Code Below? var Y = 1; if (function F(){}) { y += Typeof F; } console.log(y); |
|
Answer» The output would be 1undefined. The if CONDITION statement evaluates USING EVAL, so eval(function f(){}) returns function f(){} (which is true). Therefore, inside the if statement, executing typeof f returns undefined because the if statement code executes at RUN time, and the statement inside the if condition is evaluated during run time. var k = 1; The output would be 1undefined. The if condition statement evaluates using eval, so eval(function f(){}) returns function f(){} (which is true). Therefore, inside the if statement, executing typeof f returns undefined because the if statement code executes at run time, and the statement inside the if condition is evaluated during run time. var k = 1; |
|