Skip to content

JavaScript Continue Statement

Syntax

The continue statement in JavaScript skips the current iteration of a loop and moves to the next iteration.

for (let i = 0; i < 10; i++) {
if (condition) {
continue; // Skip the rest of the loop for this iteration
}
// Code to execute if condition is false
}

Example

for (let i = 1; i <= 5; i++) {
if (i === 3) {
continue; // Skip the iteration where i is 3
}
console.log(i);
}
// Output:
// 1
// 2
// 4
// 5