Functions: hoisted 'at the top of the area in which they live.
So your code really reads:
(function f() {
function f() { return 1; }
function f() { return 2; }
function f() { return 1.5; }
return f();
})();
QED:
(function f() {
function f() { return 1; }
return f();
function f() { return 1.5; }
function f() { return 2; }
})();
source
share