 
This chapter introduced each of the statements of the JavaScript language. Table 6-1 summarizes these statements, listing the syntax and purpose of each.
| Statement | Syntax | Purpose | 
|---|---|---|
| break | break; break labelname; | Exit from the innermost loop or switch statement or from the statement named by label. | 
| case | case expression: | Label a statement within a switch statement. | 
| continue | continue; continue labelname; | Restart the innermost loop or the loop named by label. | 
| default | default: | Label the default statement within a switch statement. | 
| do/while |  | An alternative to the while loop. | 
| empty | ; | Do nothing. | 
| for |  | An easy-to-use loop. | 
| for/in |  | Loop through the properties of an object. | 
| function |  | Declare a function. | 
| if/else |  | Conditionally execute code. | 
| label | identifier: statement | Give statement the name identifier. | 
| return | return [expression]; | Return from a function or return the value of expression from a function. | 
| switch |  | Multiway branch to statements labeled with case or default: . | 
| throw | throw expression; | Throw an exception. | 
| try |  | Catch an exception. | 
| var | var name_1 [ = value_1] [ ..., name_n [ = value_n]]; | Declare and initialize variables. | 
| while |  | A basic loop construct. | 
| with |  | Extend the scope chain. (Deprecated.) | 
 
Copyright © 2003 O'Reilly & Associates. All rights reserved.