Recently, I came across an unusual JavaScript function:
(function f(){
function f(){ return 1; }
return f();
function f(){ return 2; }
})();
To my surprise, it returns 2 instead of crashing the browsers as expected due to recursion.
Curious if anyone can shed light on this unexpected behavior.