Hint
Function expressions stored in var are NOT hoisted as functions β only the var declaration is.
console.log(typeof foo);
console.log(foo());
var foo = function() {
return 'hello';
};undefined TypeError: foo is not a function
Explanation: var foo is hoisted as undefined. Calling undefined() throws TypeError. The function is not assigned until that line executes.
Key Insight: Function expressions stored in var are NOT hoisted as functions β only the var declaration is.