Favorites

JavaScript break Statement

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
break
JavaScript Control FlowThis statement is supported by all modern browsers.
Updated 28th November 2026

The break statement exits a loop or switch immediately, continuing with the code after it.

Description

The break statement terminates the current loop or switch and transfers control to the statement after it. It's used to stop searching once you've found what you need. With a label, it can exit an outer loop from inside a nested one.

break doesn't work inside a forEach() callback; use a for...of loop, or some() or find(), if you need to stop early.

Inside a switch, break ends the current case; without it, execution falls through into the next one. Inside nested loops, a plain break only exits the innermost loop, which is where labeled statements come in. You can't use break to leave a function or an if block on its own; use return for functions.

Syntax

break;
break label;

Example

const numbers = [3, 8, 12, 5, 20];
for (const n of numbers) {
  if (n > 10) {
    console.log('First over 10:', n);
    break;
  }
  console.log('checked', n);
}

Browser Support

The following information will show you the current browser support for the break statement. Hover over a browser icon to see the version that first introduced support for this statement.

This statement is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee