The while statement is a pretest loop.
The loop condition is evaluated before the loop body has been executed.
Tt is possible that the body of the loop is never executed. Here's the syntax:
while(expression)
statement
And here's an example:
var i = 0; while (i < 10) { i += 2; }
In this example, the variable i starts out equal to 0 and is incremented by two each time through the loop.
As long as the variable is less than 10, the loop will continue.