The scope is an important concept that manages the availability of variables. The scope is at the base closures, defines the idea of global and local variables.
If you’d like to code in JavaScript, understanding the scope of variables is a must.
In this post, I will explain step by step, in-depth, how the scope works in JavaScript.
What’s scope
Block scope
2.1 var is not block scoped
Function scope
Module scope
Scopes can be nested
Global scope
Lexical scope
Variables isolation
Conclusion
#javascript #scope #variable