Essential JavaScript

Continuing a Loop

We used the break keyword earlier to break out of a loop entirely.

It is also possible to simply continue to the next iteration of the loop:

let i = 0;
while (i < 10) {
  if (i % 2 === 0) {

In this example, any time i is an even number the loop will continue.

The continue statement causes the current iteration of the loop to stop. If the loop is still running, the next iteration will start.

Learning Goals

Code Editor