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;/*  ww  w .j a va 2  s. c o  m*/
for (i = 1; i < 10; i++) {
    if (i === 5 || i === 7) continue;
    console.log( i + "\n" );
}

Result

Related Exercise