[Chapter 5] 5.14 Summary of JavaScript Statements
Author: David Flanagan
Date: Fri Aug 29 10:52:44 1997

#

| Chapter 5 Statements |

## 5.14 Summary of JavaScript Statements

This chapter has introduced each of the statements of the JavaScript language. Table 5.1 summarizes these statements, their syntax, and their purpose.

Table 5.1: JavaScript Statement Syntax
Statement | Syntax | Purpose
--- | --- | ---
break |
    break;
| Exit from the innermost loop.
continue |
    continue;
| Jump to top of containing loop.
empty |
    ;
| Do nothing.
for |
    for (initialize ; test ; increment)
        statement
| Easy-to-use loop.
for/in |
    for (variable in object)
        statement
| Loop through properties of object.
function |
    function funcname([arg1 [..., argn]]) {
        statements
    }
| Declare a function.
if/else |
    if (expression)
        statement1
    [ else
        statement2 ]
| Conditionally execute code.
return |
    return expression;
| Return a value from a function.
var |
    var name_1 [ = value_1 ]
        [ ..., name_n [ = value_n]] ;
| Declare and initialize variables.
while |
    while (expression)
        statement
| Basic loop construct.
with |
    with (object)
        statement
| Specify the current name space.

The Empty Statement |  | Functions