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

Javascript examples for Statement:Quiz

Description

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<script>
var text = "";
var i;/*from   w  w  w .  jav a2  s  .  c o  m*/
for (i = 1; i < 10; i++) {
    if (i === 5)
       continue;
    document.getElementById("demo").innerHTML += i + "<br>";
}
</script>

</body>
</html>

Related Tutorials