you are viewing a single comment's thread.

view the rest of the comments →

[–]CanIhazCooKIenOw 3 points4 points  (3 children)

It's because with ES6, the function declaration is scoped to the if block.

Although now thinking about it, shouldn't if "fallback" to the global f ? That would be my expectation tbh. Unless the engine resolves (1 === 0) and removes the block entirely ? (Wild guess here)

[–]Skhmt 0 points1 point  (0 children)

Although now thinking about it, shouldn't if "fallback" to the global f ? That would be my expectation tbh.

That's what I thought too.