Javascript examples for Statement:continue
Using the continue statement - Loop through a block of code, but skip the value of "3":
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w ww .j av a2s. c om*/ var text = ""; var i = 0; while (i < 5) { i++; if (i === 3) { continue; } text += "<br>The number is " + i; } document.getElementById("demo").innerHTML = text; } </script> </body> </html>