Variable Scoping in Javascript
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. Before going further, a couple of lines on the basics Javascript is an interpreted language, but runs code using a compiler + interpreter engine combo. So, this is the normal execution of the program - ...