Files
2nd/10_Wiki/Topics/Domain_Programming/Topic_JavaScript/JavaScript_Break.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

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
break statement
JS break
labeled break
break continue
break label
B 0.89 2026-06-23 2026-06-23
javascript
js
web
frontend
w3schools
break
loops
labels
control-flow
https://www.w3schools.com/js/js_break.asp

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 blockbreak 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.

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)

📚 출처 (Sources)

📝 변경 이력 (Change history)

  • 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Break" page (Astra wiki-curation, P-Reinforce v3.1 format).