while we're busting popular JS myths... "let doesn't hoist". False. var x = 2; { console.log(x); let x = 3; } That code throws a TDZ error because the `x` in `let x` was in fact hoisted to the { } scope; it's just uninitialized. If no hoisting, would print `2`.
-
-
sigh. when I said "identically" I was talking about their behavior of attaching an identifier to start of a scope, not that they pick the same scope to attach to. I obvs know they bind to diff scopes. The point of the thread is that they both hoist, but don't initialize the same.
- 5 more replies
New conversation -
-
This Tweet is unavailable.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.