A variable statement uses the var keyword to preface a list of variable declarations. The statement is terminated with a semicolon.
You can declare the variables one at a time or several at once with the same var statement.
When the variables are declared, an initial value can be assigned to them at the outset.
Variables can be declared inside a function body. When they are declared there, they become local only to that function. When the function exits, the execution context is popped off the scope chain and the variables are discarded.
Variables can also be declared and assigned within a for loop header block.
See also: | = (Assign), Assignment expression, delete, Statement, var, Variable Declaration |
ECMA 262 edition 2 - section - 10.1.3
ECMA 262 edition 2 - section - 12.2
ECMA 262 edition 3 - section - 10.1.3
ECMA 262 edition 3 - section - 12.2
Prev | Home | Next |
Variable name | Up | VBArray object |
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. |