Skip to content Skip to sidebar Skip to footer

Javascript Named Function As An Expression

Javascript Code var d = function c() { console.log(c); }; d(); // function c() { console.log(c); }; c(); // Reference Error I understand the concept of variable hoisting where va

Solution 1:

Yes. A named function expression produces a variable corresponding to the function name within the scope of that function only.

Here's an excellent but lengthy article on the subject: http://kangax.github.com/nfe/

See also the relevant section of the ECMAScript 5 spec. It has a specific note about this.

Post a Comment for "Javascript Named Function As An Expression"