Variable Scoping in Javascript
· ☕ 5 min read
Scope of a variable refers to the visibility of that variable. Since the visibility of a variable also determines whether it can be referenced in a valid way, scopes are said to define the ‘life time of a variable’. Scopes in Javascript can be global to the program, or local to the specific block and function.