Skip to main content

JavaScript continue Statement (Live Playground)

In this tutorial, we will explore the continue statement, and learn how to use it in our code.

continue Statement​

The continue statement is used to skip the current iteration and move on to the next one when a certain condition is met.

Example:

for (let i = 0; i < 10; i++) {
if (i === 5) {
continue;
}
console.log(`Iteration ${i + 1}`);
}

In the example above, the loop skips the iteration when i is equal to 5, and the output displays the iteration number from 1 to 10, excluding 6.

Live Playground, Try it Yourself

Conclusion​

Understanding and using the continue statement is crucial for controlling loop iterations based on specific conditions.