Saved Bookmarks
| 1. |
Guess the output of the following code: |
|
Answer» var x = 23; (function(){ var x = 43; (function random(){ x++; console.log(x); var x = 21; })(); })(); Answer: Output is NaN. var x; // x is hoisted x++; // x is not a number since it is not initialized yet console.log(x); // Outputs NaN x = 21; // Initialization of x } |
|