Scope
The scope defines where variables and functions are accessible inside of your program. In JavaScript, there are two kinds of scope - global scope, and function scope. According to the official spec.
Block scopes are what you get when you use if statements, for statements, and the like. You can also use them stand-alone with a simple begin-end curly braces {}, not to be confused with empty object literals.
Global JavaScript Variables
A variable declared outside a function becomes GLOBAL. A global variable has a global scope: All scripts and functions on a web page can access it.
Last updated