This page lists the basic forms of JavaScript flow control.
if (test) {...} else {...}
switch (expr1){ case val1 : ... break; case val2 : ... break; ... default : statement; }
The break statement prevents any further check. Without the “break”, the check goes on, and will execute the block if there's match again.
for (i=0; i<10; i++) { ... }
for (var myVal in someObject) { ... myVal ...}
do {...} while (...)
while (...) {...}
“continue” exit the current iteration in a loop. (that is, start the next iteration at the beginning of loop)
with (myObject) { ... }
A shortcut so that properties of myObject in the body block needs not have prefix “myObject.”
comments is:
// this is comment or /* comment here */
In JavasSript, the ending semicolon is optional if it is at end of a line.
Reference: http://msdn2.microsoft.com/en-us/library/3xcfcb93.aspx
See also:
Page created: 2005-05. © 2005 by Xah Lee.