while (expression)
statement
The while statement works by first evaluating
expression. If it is
false, JavaScript moves on to the next statement
in the program. If it is true, the
statement that forms the body of the loop
is executed and expression is evaluated
again. Again, if the value of expression
is false, JavaScript moves on to the next
statement in the program; otherwise, it executes
statement again. This cycle continues
until expression evaluates to
false, at which point the while
statement ends and JavaScript moves on. Note that you can create an
infinite loop with the syntax while(true).