3 ms·
Right but we have `let` now which solves that problem.
by errantspark 5y ago
Right but we have `let` now which solves that problem.
- titzer 5y agoNot completely, `let` also has a weird temporal dead zone[1], which is basically a dynamic check. [1] https://www.freecodecamp.org/news/what-is-the-temporal-dead-zone/ https://www.freecodecamp.org/news/what-is-the-temporal-dead-...
- IshKebab 5y agoThat's a good thing, and I'm not sure what you mean about it being a dynamic check.
- titzer 5y agoIt's a dynamic error if you access a let-bound variable before it is actually initialized. In most other languages that have lexically-scoped declarations, it simply would not be visible. So I think JS's choice is actually a regression.