---
id: javascript-break
title: "JavaScript Break"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["break statement", "JS break", "labeled break", "break continue", "break label"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.89
created_at: 2026-06-23
updated_at: 2026-06-23
review_reason: ""
merge_history: []
tags: ["javascript", "js", "web", "frontend", "w3schools", "break", "loops", "labels", "control-flow"]
raw_sources: ["https://www.w3schools.com/js/js_break.asp"]
applied_in: []
github_commit: ""
---
# [[JavaScript Break]]
## π― ν μ€ ν΅μ°° (One-line insight)
The `break` statement jumps out of a loop or switch; with a label, it can jump out of any code block. [S1]
## π§ ν΅μ¬ κ°λ
(Core concepts)
- **Jumps out** β the `break` statement "jumps out" of loops and switches, terminating execution immediately. [S1]
- **Break in loops** β when `break` is reached in a loop, the loop terminates immediately and control transfers to the statements following the loop; no further iterations execute. [S1]
- **Break in a switch** β in a `switch`, `break` exits the block after a matching case executes; without it, execution falls through to subsequent cases. [S1]
- **Labels** β a label is an identifier followed by a colon (`labelname: statement;`), and `break labelname;` jumps out of the labeled block. [S1]
- **Only break and continue jump out of a block** β `break` and `continue` are the only JavaScript statements that can jump out of a code block; without a label, `break` only exits loops or switches. [S1]
## π§© μΆμΆλ ν¨ν΄ (Extracted patterns)
- **Early exit on a sentinel** β test a condition inside the loop and `break` when it is met. [S1]
- **Labeled break for nested loops** β name outer/inner loops and `break loop1;` / `break loop2;` to control exactly which loop terminates. [S1]
- **Break out of a plain code block** β label a `{ ... }` block and `break label;` to skip the remaining statements. [S1]
## π μΈλΆ λ΄μ© (Details)
**The break statement** [S1]
The `break` statement "jumps out" of loops and switches, terminating execution of a loop or switch statement immediately.
**Break in loops** [S1]
When `break` is encountered in a loop, the loop terminates immediately and control transfers to the statements following the loop. No further iterations execute.
```javascript
for (let i = 0; i < 10; i++) {
if (i === 3) { break; }
text += "The number is " + i + "
";
}
```
**Break in a switch** [S1]
In a `switch` statement, `break` exits the block after a matching case executes. Without it, execution "falls through" to subsequent cases.
```javascript
switch (new Date().getDay()) {
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
case 3:
day = "Wednesday";
break;
case 4:
day = "Thursday";
break;
case 5:
day = "Friday";
break;
case 6:
day = "Saturday";
}
```
**JavaScript labels** [S1]
A label is an identifier followed by a colon: `labelname: statement;`. A labeled break uses the syntax `break labelname;`.
**Break to loop1** [S1]
```javascript
let text = "";
loop1: for (let j = 1; j < 5; j++) {
loop2: for (let i = 1; i < 5; i++) {
if (i === 3) { break loop1; }
text += i;
}
}
```
**Break to loop2** [S1]
```javascript
let text = "";
loop1: for (let j = 1; j < 5; j++) {
loop2: for (let i = 1; i < 5; i++) {
if (i === 3) { break loop2; }
text += i;
}
}
```
**Break out of a code block** [S1]
```javascript
const cars = ["BMW", "Volvo", "Saab", "Ford"];
list: {
text += cars[0] + "
";
text += cars[1] + "
";
break list;
text += cars[2] + "
";
text += cars[3] + "
";
}
```
**Note** [S1]
`break` and `continue` are the only JavaScript statements that can "jump out of" a code block. Without a label, `break` only exits loops or switches; with a label, it exits any code block.
## π οΈ μ μ© μ¬λ‘ (Applied in summary)
The page's own snippets are the canonical applied examples β early-exiting a `for` loop at `i === 3`, exiting `switch` cases, labeled breaks targeting `loop1`/`loop2`, and breaking out of a labeled `list:` block. No external project/commit applications found in the source.
## π» μ½λ ν¨ν΄ (Code patterns)
Early exit from a loop:
```javascript
for (let i = 0; i < 10; i++) {
if (i === 3) { break; }
text += "The number is " + i + "
";
}
```
Labeled break out of an outer loop:
```javascript
loop1: for (let j = 1; j < 5; j++) {
loop2: for (let i = 1; i < 5; i++) {
if (i === 3) { break loop1; }
text += i;
}
}
```
Break out of a labeled code block:
```javascript
list: {
text += cars[0] + "
";
break list;
text += cars[2] + "
";
}
```
## βοΈ λͺ¨μ λ° μ
λ°μ΄νΈ (Contradictions & updates)
No contradictions found in the source.
## β
κ²μ¦ μν λ° μ λ’°λ
- **μν:** draft
- **κ²μ¦ λ¨κ³:** conceptual (μ€μ μ μ© μ¬λ‘ λ°κ²¬ μ applied/validatedλ‘ μΉκ²© κ°λ₯)
- **μΆμ² μ λ’°λ:** B (W3Schools β widely used educational reference, not a primary standards body)
- **μ λ’° μ μ:** 0.89
- **μ€λ³΅ κ²μ¬ κ²°κ³Ό:** μ κ· μμ± (New discovery)
## π μ§μ κ·Έλν (Knowledge Graph)
- **μμ/루νΈ:** [[JavaScript Tutorial]]
- **κ΄λ ¨ κ°λ
:** [[JavaScript Loops]], [[JavaScript For Loop]], [[JavaScript While Loop]], [[JavaScript Switch]]
- **μ°Έμ‘° λ§₯λ½:** Used to terminate loops/switches early; paired with `continue` as the only block-jumping statements.
## π μΆμ² (Sources)
- [S1] W3Schools β JavaScript Break β https://www.w3schools.com/js/js_break.asp
## π λ³κ²½ μ΄λ ₯ (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Break" page (Astra wiki-curation, P-Reinforce v3.1 format).