JavaScript Break and Continue

The break statement "jumps out" of a loop.

example:

for (let i = 0; i < 10; i++) {
if (i === 3) { break; }
text += "The number is " + i + "<br>";
}

The continue statement "jumps over" one iteration in the loop/The continue statement breaks one iteration (in the loop), if a specified condition occurs, and continues with the next iteration in the loop.

example:

for (let i = 0; i < 10; i++) {
if (i === 3) { continue; }
text += "The number is " + i + "<br>";
}