Skip to content
techsnow

Control Flow

Break and Continue

for (let i = 1; i <= 10; i++) {
  if (i === 3) continue; // skip 3
  if (i === 6) break;    // stop completely at 6
  console.log(i);
}

Output

1
2
4
5
  • break exits the loop immediately.
  • continue skips the rest of this round and goes to the next one.