Every execution context has its own variable object associated with it. Variables declared in the source text are added as properties to the variable object.
This mechanism is a way of making sure that variables that are local to one execution context do not affect the values of variables in another.
In the case of global and eval() code, any functions that are declared in the script source text are also added as properties of the variable object. JavaScript 1.3 and ECMAScript edition 3 introduces nested functions which means they will be added too.
For function, anonymous, and implementation-supplied code contexts, any passed in arguments (parameters) are also added as properties of the variable object.
Which particular variable object is used, and what attributes its properties take on depends on the type of code.
Prev | Home | Next |
Variable Declaration | Up | Variable name |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |