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

Javascript examples for Statement:Quiz

Description

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
var text = "";
var i;/*w  w  w.  jav  a 2 s  .  c  om*/
for (i = 1; i < 10; i++) {
    if (i === 5 || i === 7)
       continue;
    document.getElementById("demo").innerHTML += i + "<br>";
}
</script>

</body>
</html>

Related Tutorials