continue;
OR
continue[label]; // Using the label reference
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1> Example of the continue statement in JavaScript</h1>
<h3> Here, you can see that "a == 4" is skipped. </h3>
<p id = "para">
</p>
<script>
var res = "";
var a;
for (a = 1; a <=7; a++) {
if (a == 4) {
continue;
}
res += "The value of a is : " + a + "<br>";
}
document.getElementById("para").innerHTML = res;
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title> JavaScript Continue Statement </title>
</head>
<body>
<h1> Example of the JavaScript Continue Statement </h1>
<h3> You can see that the arrray values "Magenta" and "Skyblue" are skipped. </h3>
<script>
var rainbow = ["Violet", "Indigo", "Magenta", "Blue", "Skyblue", "Green", "Yellow", "Orange", "Red"];
var i = 0;
var res = "";
while(i < rainbow.length){
if (rainbow[i] == "Magenta" || rainbow[i] == "Skyblue") {
i++;
continue;
}
res = "";
res += rainbow[i] + "<br>";
i++;
document.write(res);
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<p> This is an example of the continue statement with the label </p>
<p id="para"></p>
<script>
var res = "";
var i, j;
label1: // This loop is labeled as "label1"
for (i = 1; i <=5; i++) {
res += "<br>" + "i = " + i + ", j = ";
label2: // This loop is labeled as "label2"
for (j = 1; j <= 4; j++) {
if (j == 2) {
continue label2;
}
document.getElementById("para").innerHTML = res += j + " ";
}
}
</script>
</body>
</html>