The Scope of Variables
Wednesday, April 30th, 2008The scope of a variable is the extent of the code in which the variable exists. For JavaScript variables defined within a function their scope is the function that they are defined in. Variables defined outside of functions as well as variables used without being first defined have global scope.
