Javascript - Write program to Use the continue statement to skip the numbers 5 AND 7 in the loop.

Requirements

Write program to Use the continue statement to skip the numbers 5 AND 7 in the loop.

Insert an if statement which checks if i is equal to 5 OR 7, then add continue;

var text = "";
var i;
for (i = 1; i < 10; i++) {
    //your code here
    console.log( i + "\n" );
}

Demo

var text = "";
var i;// w w w. j av  a 2  s  .  c om
for (i = 1; i < 10; i++) {
    if (i === 5 || i === 7) continue;
    console.log( i + "\n" );
}

Result

Related Exercise