we’ll take some time to look at the advanced JS statements: the loops.
The looping statements are ones that have a conditional test, just like
statements covered earlier. However, when the expression evaluates to
true, the processor returns to the
same condition again at the end of each loop.
continues if the expression evaluates to
in the loop changes at some point, forcing the expression to evaluate
false and the loop to terminate.
while is used to
designate this type of loop.
In Example 3-7, one of the test expression variables is incremented with each loop until its value exceeds 10. At that point, the loop terminates.
Example 3-7. Testing a value in a condition in a while loop
Normally, you do more with a
while loop than just increment a value, which you’ll see in more detail throughout the ...