Scoping in JavaScript: The Basics
Too Long; Didn't Read
The goal is to understand the difference between lexical and block scoping. Lexical scoping allows for the redefining of variables that are lexically scoped. Block scoped variables only exist through the use of a variable variable when declared. In contrast, lexical variables can be redeclared. In the second function, the first function will throw an error that the variable cannot be redoared. This is due to the fact that in this case, the variable variable was created with an even an even though the variable is redoed.