that's not a recursion ... that's just overriding names within a scope ...
if the interpreter would just use some type of atomic bursts without any optimizations it probably would return 1.
(function f(){
function f(){ return 1; }
return f();
function f(){ return 2; }
function f(){ return 'the function name f within this scope is overwritten again'; }
})();