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>
5.7 KiB
id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
| id | title | category | status | verification_status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | created_at | updated_at | review_reason | merge_history | tags | raw_sources | applied_in | github_commit | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| javascript-break | JavaScript Break | Frontend | draft | conceptual |
|
B | 0.89 | 2026-06-23 | 2026-06-23 |
|
|
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
breakstatement "jumps out" of loops and switches, terminating execution immediately. [S1] - Break in loops — when
breakis 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,breakexits 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;), andbreak labelname;jumps out of the labeled block. [S1] - Only break and continue jump out of a block —
breakandcontinueare the only JavaScript statements that can jump out of a code block; without a label,breakonly exits loops or switches. [S1]
🧩 추출된 패턴 (Extracted patterns)
- Early exit on a sentinel — test a condition inside the loop and
breakwhen 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 andbreak 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.
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.
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]
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]
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]
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:
for (let i = 0; i < 10; i++) {
if (i === 3) { break; }
text += "The number is " + i + "<br>";
}
Labeled break out of an outer loop:
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:
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
continueas 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).