Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
continue | Loops
Introduction to JavaScript

continuecontinue

The continue keyword allows you to skip the remaining code within a loop for the current iteration and proceed to the next iteration.

Example 1: Skipping Early Iterations

In this example, the continue keyword is used to skip iterations of the loop where i is less than 5. As a result, only iterations with i values in the range [5, 9] execute the code inside the loop.

Example 2: Skipping a Specific Iteration

Here, the continue statement is used to skip the end of the 3rd iteration, resulting in the output of "Iteration started" and "Iteration ended" messages for all iterations except the one where i equals 3.

Note

The continue keyword works similarly to break, but instead of terminating the loop entirely, it only skips the current iteration and proceeds with the next one. This behavior can be handy for fine-grained control of loop execution.

Everything was clear?

Section 5. Chapter 7
course content

Course Content

Introduction to JavaScript

continuecontinue

The continue keyword allows you to skip the remaining code within a loop for the current iteration and proceed to the next iteration.

Example 1: Skipping Early Iterations

In this example, the continue keyword is used to skip iterations of the loop where i is less than 5. As a result, only iterations with i values in the range [5, 9] execute the code inside the loop.

Example 2: Skipping a Specific Iteration

Here, the continue statement is used to skip the end of the 3rd iteration, resulting in the output of "Iteration started" and "Iteration ended" messages for all iterations except the one where i equals 3.

Note

The continue keyword works similarly to break, but instead of terminating the loop entirely, it only skips the current iteration and proceeds with the next one. This behavior can be handy for fine-grained control of loop execution.

Everything was clear?

Section 5. Chapter 7
some-alt