Javascript - Write program to Use the continue statement to skip the number 5 in the loop.

Requirements

Use the continue statement to skip the number 5 in the loop.

Insert an if statement which checks if i is equal to 5, 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;/*from  ww  w  .  j a  va2 s. c  o m*/
for (i = 1; i < 10; i++) {
    if (i === 5) continue;
    console.log( i + "\n" );
}

Result

Related Exercise