JavaScript_Succinctly
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Notes<br />
An unlimited number of function and eval scopes can be created, while only one global<br />
scope is used by a <strong>JavaScript</strong> environment.<br />
The global scope is the last stop in the scope chain.<br />
Functions that contain functions create stacked execution scopes. These stacks, which<br />
are chained together, are often referred to as the scope chain.<br />
<strong>JavaScript</strong> does not have block scope<br />
Since logic statements (e.g., if) and looping statements (e.g., for) do not create a<br />
scope, variables can overwrite each other. Examine the following code and make sure<br />
you understand that the value of foo is being redefined as the program executes the<br />
code.<br />
Sample: sample111.html<br />
<br />
var foo = 1; // foo = 1.<br />
if (true) {<br />
foo = 2; // foo = 2.<br />
for (var i = 3; i