Completion requirements
View
3. continue statement
It prevents the execution of the current iteration when JavaScript finds a continue statement in a loop and goes back to the beginning of the loop to begin the next iteration.
In the example code below, if the count variable is equal to 3, the continue statement also prevents the current iteration of the while loop, and the script skips printing the number 3. The loop, however, continues to iterate until it is false for the conditional expression count <= 5.
var
count = 1;
while (count <= 5 ) {
while (count <= 5 ) {
count++;
if (count === 3) {
document.write("<p>" + count + "</p>");
}if (count === 3) {
continue;
}document.write("<p>" + count + "</p>");