docs(10_Wiki): Dev 폴더 누락분 반영 — Topic_Programming으로 통합

이전 재구성 작업에서 Dev/ 폴더가 누락되었던 것을 반영.

- Dev/Topic_Programming(중첩 폴더, 78개)은 Dev 자체 최상위 폴더들
  (Architecture/Conventions/Engineering_Intelligence 등)과 완전 중복이라 제거.
- Dev 최상위 엔지니어링 지식 폴더(Architecture/Conventions/Engineering_Intelligence/
  Failure_Library/Generalized_Principles/Language/Pattern_Catalog/Platform_Guides/
  Subsystems, 77개)는 이미 Topic_Programming/Topic_Programming에 더 최신 버전이
  존재해 중복 제거(고유 콘텐츠 1개는 예외 처리하여 이동 보존).
- Dev의 W3Schools 언어 튜토리얼 폴더(Topic_C/CPP/CSS/CSharp/HOWTO/HTML/Java/
  JavaScript/PHP/Python/SQL/W3CSS, 1201개)는 전부 Topic_Programming 하위로 이동.
- 에이전트 운영 상태(.astra/docs)는 그대로 유지, 콘텐츠 폴더만 정리.
- Topic_Programming 최종 문서 수: 2784 → 3985.
This commit is contained in:
Antigravity Agent
2026-07-05 00:39:13 +09:00
parent 9148c358d0
commit e9cbf23ab5
1356 changed files with 0 additions and 12831 deletions
@@ -0,0 +1,136 @@
---
id: javascript-code-blocks
title: "JavaScript Code Blocks"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["curly braces", "block statement", "standalone block", "block scope", "statement grouping"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.86
created_at: 2026-06-23
updated_at: 2026-06-23
review_reason: ""
merge_history: []
tags: ["javascript", "js", "web", "frontend", "w3schools", "code-blocks", "scope", "syntax"]
raw_sources: ["https://www.w3schools.com/js/js_codeblocks.asp"]
applied_in: []
github_commit: ""
---
# [[JavaScript Code Blocks]]
## 🎯 한 줄 통찰 (One-line insight)
A code block is a group of statements wrapped in curly braces `{ }` that are treated as a single unit — and with `let`/`const` it also creates a private scope. [S1]
## 🧠 핵심 개념 (Core concepts)
- **Curly braces group statements** — a code block is one or more statements enclosed in `{ }`, executed together as a unit. [S1]
- **Used by language constructs** — functions, `if/else`, `for`, and `while` all use code blocks to hold their body. [S1]
- **Blocks define scope** — variables declared with `let` and `const` inside a block are block-scoped and accessible only within that block. [S1]
- **Standalone blocks exist** — a `{ }` block can stand on its own (not attached to a function or control statement) purely to create a local scope for `let`/`const` variables. [S1]
- **Benefits of blocks** — encapsulation, use of temporary variables, and organized code that avoids name conflicts while staying readable. [S1]
## 🧩 추출된 패턴 (Extracted patterns)
- **Wrap a body in `{ }`** — every function/condition/loop body is a code block. [S1]
- **Use a standalone block for a temporary scope** — `{ let x = ...; }` confines short-lived variables and prevents leaks into the surrounding scope. [S1]
## 📖 세부 내용 (Details)
**Curly Braces**
JavaScript code blocks are groups of statements enclosed in curly braces `{ }`. They are essential for controlling the flow of execution and for defining variable scope. [S1]
**Code Blocks and Statements**
A code block lets multiple statements be treated as a single unit. Code blocks are required by functions, `if` statements, and loops. [S1]
A function uses a code block: [S1]
```javascript
function myFunction() {
// This is a code block
}
```
An `if...else` statement uses code blocks: [S1]
```javascript
if (condition) {
// This is a code block
} else {
// This is a code block
}
```
A `for` loop uses a code block: [S1]
```javascript
for (expression 1; expression 2; expression 3) {
// This is a code block
}
```
A `while` loop uses a code block: [S1]
```javascript
while (condition) {
// This is a code block
}
```
**Defining Scope**
Variables declared with `let` and `const` inside a code block are block-scoped — they are accessible only within that specific block: [S1]
```javascript
{
let x = 10;
// x is accessible here
}
// x is not accessible here
```
**Standalone Blocks**
A code block can exist independently, without being attached to a function or control structure, simply to create a scope for `let` and `const` variables: [S1]
```javascript
{
let x = 10;
let y = 100;
let areal = x * y;
}
```
Benefits of standalone blocks include encapsulation (variables are confined to the block scope), use of temporary variables, and organized code that prevents name conflicts while maintaining readability. [S1]
## 🛠️ 적용 사례 (Applied in summary)
The page's snippets are the applied cases: bodies of functions, `if/else`, `for`, and `while`, plus a standalone `{ }` block used to scope temporary variables (`x`, `y`, `areal`). No external project/commit applications found in the source.
## 💻 코드 패턴 (Code patterns)
Block-scoped variables (language: JavaScript):
```javascript
{
let x = 10;
// x is accessible here
}
// x is not accessible here
```
Standalone block as a temporary scope:
```javascript
{
let x = 10;
let y = 100;
let areal = x * y;
}
```
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
No contradictions found in the source.
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.86
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[JavaScript Tutorial]]
- **관련 개념:** [[JavaScript Scope]], [[JavaScript var let const]], [[JavaScript Functions]], [[JavaScript If Else]]
- **참조 맥락:** Referenced when explaining how `{ }` both groups statements and confines `let`/`const` variables.
## 📚 출처 (Sources)
- [S1] W3Schools — JavaScript Code Blocks — https://www.w3schools.com/js/js_codeblocks.asp
## 📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Code Blocks" page (Astra wiki-curation, P-Reinforce v3.1 format).