JavaScript Control Flow Loops
Continue
The continue statement terminates the current iteration; works for both for
and while loops.
for (let i = 0; i < 5; i++) {if (i === 2) {continue;}console.log(i)}console.log('first statement after loop')// 0// 1// 3// 4// 5// first statement after loop
Notice how we the if statement within the for loop terminates the
current iteration if i equals 2.