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:
@@ -0,0 +1,138 @@
|
||||
---
|
||||
id: javascript-statements
|
||||
title: "JavaScript Statements"
|
||||
category: "Frontend"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["JS statements", "semicolons", "code blocks", "white space", "JS keywords"]
|
||||
duplicate_of: ""
|
||||
source_trust_level: "B"
|
||||
confidence_score: 0.88
|
||||
created_at: 2026-06-23
|
||||
updated_at: 2026-06-23
|
||||
review_reason: ""
|
||||
merge_history: []
|
||||
tags: ["javascript", "js", "web", "frontend", "w3schools", "statements", "semicolons"]
|
||||
raw_sources: ["https://www.w3schools.com/js/js_statements.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[JavaScript Statements]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
A JavaScript program is a list of statements — composed of values, operators, expressions, keywords, and comments — executed in the order they are written and separated by semicolons. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **A program is a list of statements** — a computer program is a list of "instructions" to be "executed" by a computer; in JavaScript these instructions are called statements. [S1]
|
||||
- **What statements are made of** — values, operators, expressions, keywords, and comments. [S1]
|
||||
- **Semicolons separate statements** — semicolons separate JavaScript statements; multiple statements on one line are allowed when separated by semicolons. [S1]
|
||||
- **White space is ignored** — JavaScript ignores multiple spaces; add spaces around operators for readability. [S1]
|
||||
- **Line breaks** — for best readability, keep lines under 80 characters and break after an operator. [S1]
|
||||
- **Code blocks** — statements can be grouped together in code blocks inside curly brackets `{ ... }`, typically defining functions. [S1]
|
||||
|
||||
## 🧩 추출된 패턴 (Extracted patterns)
|
||||
- **Declare-then-assign sequence** — declare variables, then assign and compute across ordered statements. [S1]
|
||||
- **One-line grouping** — multiple statements may be packed on a single line with semicolons (`a = 5; b = 6; c = a + b;`). [S1]
|
||||
- **Break-after-operator** — when a statement is too long, break the line after an operator. [S1]
|
||||
- **Block grouping** — wrap related statements in `{ }` to form a function body executed together. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
**JavaScript Programs** — A computer program is a list of "instructions" to be "executed" by a computer. In a programming language, these programming instructions are called statements. A JavaScript program is a list of programming statements. In HTML, JavaScript programs are executed by the web browser. [S1]
|
||||
|
||||
**JavaScript Statements** — JavaScript statements are composed of values, operators, expressions, keywords, and comments. This statement tells the browser to write "Hello Dolly." inside an HTML element with `id="demo"`: [S1]
|
||||
```javascript
|
||||
document.getElementById("demo").innerHTML = "Hello Dolly.";
|
||||
```
|
||||
Most JavaScript programs contain many JavaScript statements, executed in the same order as they are written: [S1]
|
||||
```javascript
|
||||
let x, y, z; // Statement 1
|
||||
x = 5; // Statement 2
|
||||
y = 6; // Statement 3
|
||||
z = x + y; // Statement 4
|
||||
```
|
||||
|
||||
**Semicolons ;** — Semicolons separate JavaScript statements. Add a semicolon at the end of each executable statement: [S1]
|
||||
```javascript
|
||||
let a, b, c; // Declare 3 variables
|
||||
a = 5; // Assign the value 5 to a
|
||||
b = 6; // Assign the value 6 to b
|
||||
c = a + b; // Assign the sum of a and b to c
|
||||
```
|
||||
When separated by semicolons, multiple statements on one line are allowed: [S1]
|
||||
```javascript
|
||||
a = 5; b = 6; c = a + b;
|
||||
```
|
||||
|
||||
**JavaScript White Space** — JavaScript ignores multiple spaces. You can add white space to your script to make it more readable. A good practice is to put spaces around operators (`= + - * /`). [S1]
|
||||
|
||||
**JavaScript Line Length and Line Breaks** — For best readability, programmers often like to avoid code lines longer than 80 characters. If a JavaScript statement does not fit on one line, the best place to break it is after an operator: [S1]
|
||||
```javascript
|
||||
document.getElementById("demo").innerHTML =
|
||||
"Hello Dolly!";
|
||||
```
|
||||
|
||||
**JavaScript Code Blocks** — JavaScript statements can be grouped together in code blocks, inside curly brackets `{...}`. The purpose of code blocks is to define statements to be executed together. One place you will find statements grouped together in blocks is in JavaScript functions: [S1]
|
||||
```javascript
|
||||
function myFunction() {
|
||||
document.getElementById("demo1").innerHTML = "Hello Dolly!";
|
||||
document.getElementById("demo2").innerHTML = "How are you?";
|
||||
}
|
||||
```
|
||||
|
||||
**JavaScript Keywords** — JavaScript statements often start with a keyword to identify the JavaScript action to be performed. The following table lists some of the keywords: [S1]
|
||||
|
||||
| Keyword | Description |
|
||||
|---------|-------------|
|
||||
| var | Declares a variable |
|
||||
| let | Declares a block variable |
|
||||
| const | Declares a block constant |
|
||||
| if | Marks a block of statements to be executed on a condition |
|
||||
| switch | Marks a block of statements to be executed in different cases |
|
||||
| for | Marks a block of statements to be executed in a loop |
|
||||
| function | Declares a function |
|
||||
| return | Exits a function |
|
||||
| try | Implements error handling to a block of statements |
|
||||
|
||||
JavaScript keywords are reserved words and cannot be used as names for variables. [S1]
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
The page's own snippets are the canonical applied examples — the ordered `let x, y, z` / assign / sum statements, the one-line `a = 5; b = 6; c = a + b;`, the operator line break, and the two-statement function block. No external project/commit applications found in the source.
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Ordered statements:
|
||||
```javascript
|
||||
let x, y, z;
|
||||
x = 5;
|
||||
y = 6;
|
||||
z = x + y;
|
||||
```
|
||||
Code block (function):
|
||||
```javascript
|
||||
function myFunction() {
|
||||
document.getElementById("demo1").innerHTML = "Hello Dolly!";
|
||||
document.getElementById("demo2").innerHTML = "How are you?";
|
||||
}
|
||||
```
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
No contradictions found in the source.
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.88
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[JavaScript Tutorial]]
|
||||
- **관련 개념:** [[JavaScript Syntax]], [[JavaScript Comments]], [[JavaScript Variables]]
|
||||
- **참조 맥락:** Defines the unit of execution referenced by every later control-flow and function topic.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — JavaScript Statements — https://www.w3schools.com/js/js_statements.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Statements" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user