Since all IIFEs are function expressions, like a function declaration, does JavaScript allocate memory BEFOREHAND(before running any code) for a function expression that is lexically inside the global execution context?
If yes, since functions get stored in memory first before variable declaration, the IIFE's execution context will exit even before the variables are declared because it is called immediately.
(function(){
console.log(foo); // (1)
})();
var foo=0;
(1): should return Uncaught ReferenceError: 'a' is not defined Error, but instead of a's value being undefined. Why?