Languages
[Edit]
EN

JavaScript - continue statement

0 points
Created by:
Jan-Alfaro
681

In this article, we would like to show you how to use continue statement in JavaScript.

Quick solution:

// ONLINE-RUNNER:browser;

for (let i = 0; i < 5; i++) {
  if (i === 3) {
    continue;
  }
  console.log(i);
}

The continue statement is used to skip the current iteration of the loop if the specified condition occurs. In this case the loop breaks when our counter (i) reaches the value of 3 and continues with the next iteration.

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

JavaScript - Statements & declarations

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join