var a = function b() {
};
console.log(typeof b); //gives undefined
console.log(typeof a); //gives function
Why the difference in the two outputs?
I understand the difference between function expression and function statement, but not able to understand the output above.
From what I know, javascript makes var a
point to the memory allocated to named function b here. In such a case typeof b
should also return function
but it returns undefined
Any explanations?