docs(10_Wiki): W3Schools 위키화 — HTML/CSS/JavaScript(core)

W3Schools 튜토리얼을 P-Reinforce v3.1 포맷으로 위키화(영어 본문, 한/영 섹션 헤더).
- Topic_HTML: 59문서 (튜토리얼+예제, 레퍼런스/메타 제외)
- Topic_CSS: 190문서 (메인 + Advanced/Flexbox/Grid/RWD 전체)
- Topic_JavaScript: 120문서 (코어 언어; Temporal/DOM상세/BOM/WebAPI/AJAX/jQuery/Graphics 등은 후속)
각 폴더 00_INDEX.md(MOC) 포함. 코드 verbatim, 미확인분은 "Not found in source" 표기.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-23 19:21:18 +09:00
parent 8957890d13
commit 9609c04755
379 changed files with 54618 additions and 6 deletions
@@ -0,0 +1,169 @@
---
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 + "<br>";
}
```
**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] + "<br>";
text += cars[1] + "<br>";
break list;
text += cars[2] + "<br>";
text += cars[3] + "<br>";
}
```
**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 + "<br>";
}
```
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] + "<br>";
break list;
text += cars[2] + "<br>";
}
```
## ⚖️ 모순 및 업데이트 (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).