Simple demonstration of the use of scope mechanics in JavaScript, let and var produce different results based on the scope of the variable. var declared globally is accessible globally, var's can also be accessed inside of a function. However, let is used to allow scope mechanics to be used, allowing us to create two different values of the same variable because we 'let' animal hold a different value inside of a function's scope.
maximshly / java-html-scope Goto Github PK
View Code? Open in Web Editor NEWSimple demonstration of the use of scope mechanics in JavaScript, let and var produce different results based on the scope of the variable.