Hacker News new | ask | show | jobs
by mercer 3801 days ago
I'd say that makes you technically correct, but practically speaking, if using let before it's declared (assigned?), this temporal dead zone, results in an error, it's pretty much not hoisted in the way that most of us think of it.

Or is there a use case that I'm not aware of where the hoisting is beneficial despite the temporal dead zone?

1 comments

    let f = function() { ... g(); ... }
    let g = function() { ... f(); ... }
    f();
Works despite the temporal dead zone and depends on hoisting. This exact example is why hoisting was kept for let.
Interesting. This kind of stuff makes me want to dive into the details of these kinds of choices, as I regularly wonder why languages designed are a certain way.