InterviewSolution
| 1. |
What Will Be The Output Of The Code Below? // Nfe (named Function Expression var Foo = Function Bar() { return 12; }; typeof Bar(); |
|
Answer» The output would be Reference Error. To make the code above WORK, you can re-write it as FOLLOWS: Sample 1 var bar = function() or Sample 2 function bar() A function definition can have only one reference variable as its function NAME. In sample 1, bar's reference variable points to anonymous function. In sample 2, the function's definition is the name function. var foo = function bar() The output would be Reference Error. To make the code above work, you can re-write it as follows: Sample 1 var bar = function() or Sample 2 function bar() A function definition can have only one reference variable as its function name. In sample 1, bar's reference variable points to anonymous function. In sample 2, the function's definition is the name function. var foo = function bar() |
|