A compound statement is a block of one or more statements gathered together and executed as if they were a single statement. This is a somewhat wordy description of what a function declaration provides. Other similar uses are the code that is iterated in a while or for loop and the code that is conditionally executed in an if ... else construct.
Any variables created within a compound statement will be local to the enclosing function if the compound statement exists inside a function's execution context, otherwise they will be globally scoped. In JavaScript you cannot localize the scope of a variable to within an if(), while(), or for() construct in the way that you can in C language.
Prev | Home | Next |
Compositor() | Up | Concatenate (+) |
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. |