Javascript examples for Statement:for
Loop through a block of code, but skip the numbers 2 and 3 using the OR operator
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w .j ava 2 s .c o m*/ var text = ""; var i; for (i = 1; i < 8; i++) { if (i === 2 || i === 3) continue; document.getElementById("demo").innerHTML += i + "<br>"; } } </script> </body> </html>