![]() |
VOOZH | about |
The continue statement in JavaScript is used to break the iteration of the loop and follow with the next iteration.
Example of continue to print only odd Numbers smaller than 10
1 3 5 7 9
If continue is used in a for loop, the control flow jumps to the test expression after skipping the current iteration.
The major difference between the continue and break statement is that the break statement breaks out of the loop completely while continue is used to break one statement and iterate to the next statement.
With continue, the current iteration of the loop is skipped, and control flow resumes in the next iteration of while loop
In the below example, the first condition is checked, and if the condition is true then the while loop is again executed.
1 3 5 7 9 11