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,163 @@
|
||||
---
|
||||
id: javascript-syntax
|
||||
title: "JavaScript Syntax"
|
||||
category: "Frontend"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["JS syntax", "literals", "identifiers", "case sensitivity", "camelCase"]
|
||||
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", "syntax", "identifiers"]
|
||||
raw_sources: ["https://www.w3schools.com/js/js_syntax.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[JavaScript Syntax]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
JavaScript syntax is the set of rules for how programs are constructed — built from values (literals and variables), keywords, operators, expressions, and identifiers, all of which are case-sensitive. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **Syntax = construction rules** — JavaScript syntax is the set of rules for how JavaScript programs are constructed. [S1]
|
||||
- **Two kinds of values** — fixed values (literals) and variable values (variables). [S1]
|
||||
- **Literals** — numbers are written with or without decimals; strings are text written within double or single quotes. [S1]
|
||||
- **Keywords create variables** — the `let` and `const` keywords are used to create variables; keywords are case-sensitive. [S1]
|
||||
- **Variables store data** — variables are containers for storing data values and must have unique names. [S1]
|
||||
- **JavaScript is case-sensitive** — `lastName` and `lastname` are two different variables. [S1]
|
||||
|
||||
## 🧩 추출된 패턴 (Extracted patterns)
|
||||
- **Declare → assign → compute** — declare variables with `let`/`const`, assign values, then combine them in expressions. [S1]
|
||||
- **Lower camelCase naming** — hyphens are not allowed; underscores and PascalCase are possible, but JavaScript programmers tend to use lower camelCase. [S1]
|
||||
- **Identifier rules** — start with a letter, `_`, or `$`; later characters may include digits; never a reserved keyword; case-sensitive. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
**JavaScript Syntax** — JavaScript syntax is the rules for how JavaScript programs are constructed. A basic program declares variables, computes values, and may contain comments: [S1]
|
||||
```javascript
|
||||
// How to Declare variables:
|
||||
let x = 5;
|
||||
let y = 6;
|
||||
|
||||
// How to Compute values:
|
||||
let z = x + y;
|
||||
|
||||
// I am a Comment. I do Nothing
|
||||
```
|
||||
|
||||
**JavaScript Values** — The JavaScript syntax defines two types of values: fixed values (literals) and variable values (variables). [S1]
|
||||
|
||||
**JavaScript Literals** — Numbers are written with or without decimals: [S1]
|
||||
```javascript
|
||||
10.50
|
||||
|
||||
1001
|
||||
```
|
||||
Strings are text, written within double or single quotes: [S1]
|
||||
```javascript
|
||||
"John Doe"
|
||||
|
||||
'John Doe'
|
||||
```
|
||||
|
||||
**JavaScript Keywords** — JavaScript keywords are used to identify actions to be performed. The `let` and `const` keywords tell the browser to create variables: [S1]
|
||||
```javascript
|
||||
let x = 5;
|
||||
|
||||
const fname = "John";
|
||||
```
|
||||
|
||||
**JavaScript Variables** — In a programming language, variables are used to store data values. JavaScript uses the keywords `var`, `let`, and `const` to declare variables. An equal sign (`=`) is used to assign values to variables: [S1]
|
||||
```javascript
|
||||
// Define x as a variable
|
||||
let x;
|
||||
|
||||
// Assign the value 6 to x
|
||||
x = 6;
|
||||
```
|
||||
|
||||
**JavaScript Operators** — JavaScript uses arithmetic operators (`+`, `-`, `*`, `/`) to compute values, and an assignment operator (`=`) to assign values to variables: [S1]
|
||||
```javascript
|
||||
let x = 5;
|
||||
let y = 6;
|
||||
let sum = x + y;
|
||||
```
|
||||
|
||||
**JavaScript Expressions** — An expression is a combination of values, variables, and operators which computes to a value. The computation is called an evaluation. Expressions can also contain variable values, and the values can be of various types, such as numbers and strings: [S1]
|
||||
```javascript
|
||||
5 * 10
|
||||
```
|
||||
```javascript
|
||||
(5 + 6) * 10
|
||||
```
|
||||
```javascript
|
||||
x * 10
|
||||
```
|
||||
```javascript
|
||||
"John" + " " + "Doe"
|
||||
```
|
||||
|
||||
**JavaScript Identifiers / Names** — Identifiers are JavaScript names, used to name variables, keywords, and functions. The rules for legal names are: [S1]
|
||||
- Names can contain letters, digits, underscores, and dollar signs.
|
||||
- Names must begin with a letter, `$`, or `_`.
|
||||
- Names are case-sensitive.
|
||||
- Reserved words (like JavaScript keywords) cannot be used as names.
|
||||
|
||||
**JavaScript is Case Sensitive** — All JavaScript identifiers are case-sensitive. The variables `lastName` and `lastname` are two different variables: [S1]
|
||||
```javascript
|
||||
let lastName = "Doe";
|
||||
let lastname = "Peterson";
|
||||
```
|
||||
|
||||
**JavaScript and Camel Case** — Historically, programmers have used different ways of joining multiple words into one variable name: hyphens (not allowed in JavaScript — they are reserved for subtractions), underscores, Upper Camel Case (Pascal Case), and Lower Camel Case. JavaScript programmers tend to use camel case that starts with a lowercase letter. [S1]
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
The page's own snippets are the canonical applied examples — declaring with `let`/`const`, computing `x + y`, evaluating expressions like `(5 + 6) * 10`, and the case-sensitive `lastName`/`lastname` pair. No external project/commit applications found in the source.
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Declare, assign, compute:
|
||||
```javascript
|
||||
let x = 5;
|
||||
let y = 6;
|
||||
let z = x + y;
|
||||
```
|
||||
String concatenation expression:
|
||||
```javascript
|
||||
"John" + " " + "Doe"
|
||||
```
|
||||
|
||||
## ⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
|
||||
For joining multiple words into one identifier, the source presents the options and JavaScript's convention: [S1]
|
||||
|
||||
| Style | Example | JavaScript stance |
|
||||
|-------|---------|-------------------|
|
||||
| Hyphens | `first-name` | Not allowed (reserved for subtraction) |
|
||||
| Underscores | `first_name` | Possible |
|
||||
| Upper Camel Case (Pascal) | `FirstName` | Possible |
|
||||
| Lower Camel Case | `firstName` | Preferred convention by JavaScript programmers |
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (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 Statements]], [[JavaScript Variables]], [[JavaScript Comments]]
|
||||
- **참조 맥락:** The grammar layer underpinning every other JavaScript topic.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — JavaScript Syntax — https://www.w3schools.com/js/js_syntax.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Syntax" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user