Itay Perry+ Your Authors @ItayPerry JavaScript Enthusiast 🦇 React/Node.js ⛵️🍵 Feb. 16, 2020 1 min read + Your Authors

#YDKJSY #javascript
"JS is lexically scoped, though many claim it isn't, because of two particular characteristics of its model that are not present in other lexically scoped languages."

"The first is commonly called hoisting: when all variables declared anywhere in a scope are treated as if they're declared at the beginning of the scope. The other is that var-declared variables are function scoped, even if they appear inside a block."

"Neither hoisting nor function-scoped var are sufficient to back the claim that JS is not lexically scoped. let/const declarations have a peculiar error behavior called the "Temporal Dead Zone" (TDZ) which results in observable but unusable variables."

"Though TDZ can be strange to encounter, it's also not an invalidation of lexical scoping. All of these are just unique parts of the language that should be learned and understood by all JS developers."

So little words, and yet they mean so much!
'You Don't Know JS Yet' by @getify is awesome!


You can follow @ItayPerry.



Bookmark

____
Tip: mention @threader_app on a Twitter thread with the keyword “compile” to get a link to it.

Enjoy Threader? Sign up.

Since you’re here...

... we’re asking visitors like you to make a contribution to support this independent project. In these uncertain times, access to information is vital. Threader gets 1,000,000+ visits a month and our iOS Twitter client was featured as an App of the Day by Apple. Your financial support will help two developers to keep working on this app. Everyone’s contribution, big or small, is so valuable. Support Threader by becoming premium or by donating on PayPal. Thank you.


Follow Threader