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.