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
for (let i = 0; i < 10; i++) {
if (i % 2 == 0) continue;
console.log(i);
}
Output
1 3 5 7 9
How Does Continue Work?
If continue is used in a for loop, the control flow jumps to the test expression after skipping the current iteration.

Continue vs Break
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.
How does the continue statement work for while loop?
With continue, the current iteration of the loop is skipped, and control flow resumes in the next iteration of while loop

Using Continue in While Loop
In the below example, the first condition is checked, and if the condition is true then the while loop is again executed.
let i = 0;
while (i < 11) {
i++;
if (i % 2 == 0) continue;
console.log(i);
}
Output
1 3 5 7 9 11

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
