A statement is a discrete instruction in a script that causes something to happen.
The statements in JavaScript can be classified into several categories. Here are the basic set of classifications:
Block - Some code enclosed in braces.
Variable statement - A declaration of a local or global variable.
Empty statement - A semi-colon on its own.
Expression statement - An operator and its require operand(s).
If statement - Conditional execution of a block of code with an optional alternative block of code.
Iterative statement - A means of executing a block of code repetitively until a test condition is satisfied.
Switch selector - A means of executing one of a variety of possible code blocks selecting the best according to an input value.
Continue statement - A way of cancelling an iteration and commencing the next.
Break statement - Means of breaking out of an iteration or a switch selector.
Return statement - A way to unconditionally leave a function and return to its caller, optionally handing back a value.
With statement - A means of adding an object to a scope chain.
Statements are executed in the order in which they appear in the script source text except when the flow of control is redirected by a conditional switching expression, function call, iterator or jump statement.
ECMA 262 edition 2 - section 12
ECMA 262 edition 3 - section 12
Wrox Instant JavaScript - page 16
Prev | Home | Next |
Standalone JavaScript | Up | static |
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. |