Control Loop Iterations in JavaScript
JavaScript·2 min read·Jan 1, 2026
In JavaScript, the break and continue statements allow you to control the execution flow of loops by either terminating them prematurely or skipping their iterations.
The break keyword
The break keyword is used to immediately terminate a running loop, regardless of whether the loop's condition is met or not.
loop { statements break;}Example
Let's consider this script, that outputs the individual characters of a string until it encounters the 's' character:
const word = 'javascript';let index = 0;while (word[index] !== undefined) { if (word[index] === 's') { break; } console.log(word[index]); index++;