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.
| Statement | Syntax | Purpose |
|---|---|---|
| break |
break; | Exit from the innermost loop. |
| continue |
continue; | Jump to top of containing loop. |
| empty |
; | Do nothing. |
| for |
for ( | Easy-to-use loop. |
| for/in |
for ( | Loop through properties of object. |
| function |
function | Declare a function. |
| if/else |
if ( | Conditionally execute code. |
| return |
return
| Return a value from a function. |
| var |
var | Declare and initialize variables. |
| while |
while ( | Basic loop construct. |
| with |
with ( | Specify the current name space. |