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,190 @@
|
||||
---
|
||||
id: javascript-operators
|
||||
title: "JavaScript Operators"
|
||||
category: "Frontend"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["JS operators", "JavaScript operator types", "arithmetic operators", "assignment operators", "comparison operators", "logical operators", "concatenation operator"]
|
||||
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", "operators"]
|
||||
raw_sources: ["https://www.w3schools.com/js/js_operators.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[JavaScript Operators]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
JavaScript operators are used for mathematical and logical computations — the `=` assigns, `+` adds (and concatenates strings), `*` multiplies, and comparison/logical operators evaluate conditions. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **Operators are for mathematical and logical computations** — they perform operations on values and variables. [S1]
|
||||
- **Four core single examples** — the assignment operator `=` assigns values, the addition operator `+` adds, the multiplication operator `*` multiplies, and the comparison operator `>` compares. [S1]
|
||||
- **Operator categories** — JavaScript operators include Arithmetic, Assignment, Comparison, Logical, and String operators. [S1]
|
||||
- **`+` is overloaded** — when used on strings, the `+` operator is called the concatenation operator; if you add a number and a string, the result is a string. [S1]
|
||||
- **Comparisons return booleans** — comparison operators always return `true` or `false`, and strings are compared alphabetically. [S1]
|
||||
|
||||
## 🧩 추출된 패턴 (Extracted patterns)
|
||||
- **Compute into a new variable** — combine two operands with an arithmetic operator and store the result: `let z = x + y;`. [S1]
|
||||
- **Compound assignment** — `x += 5` is shorthand for `x = x + 5`. [S1]
|
||||
- **Concatenate then assign** — build a string with `+` and a separator: `text1 + " " + text2`. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
**Operators are for Mathematical and Logical Computations** [S1]
|
||||
The assignment operator (`=`) assigns a value to a variable:
|
||||
```javascript
|
||||
let x = 10;
|
||||
```
|
||||
The addition operator (`+`) adds values:
|
||||
```javascript
|
||||
let x = 5;
|
||||
let y = 2;
|
||||
let z = x + y;
|
||||
```
|
||||
The multiplication operator (`*`) multiplies values:
|
||||
```javascript
|
||||
let x = 5;
|
||||
let y = 2;
|
||||
let z = x * y;
|
||||
```
|
||||
A more complex expression mixing addition and multiplication: [S1]
|
||||
```javascript
|
||||
let a = 3;
|
||||
let x = (100 + 50) * a;
|
||||
```
|
||||
|
||||
**Types of JavaScript Operators** [S1]
|
||||
There are different types of JavaScript operators: Arithmetic, Assignment, Comparison, String, Logical, and others.
|
||||
|
||||
**JavaScript Arithmetic Operators** [S1]
|
||||
Arithmetic operators are used to perform arithmetic on numbers:
|
||||
|
||||
| Operator | Description |
|
||||
|----------|-------------|
|
||||
| + | Addition |
|
||||
| - | Subtraction |
|
||||
| * | Multiplication |
|
||||
| ** | Exponentiation |
|
||||
| / | Division |
|
||||
| % | Modulus (Division Remainder) |
|
||||
| ++ | Increment |
|
||||
| -- | Decrement |
|
||||
|
||||
**JavaScript String Addition** [S1]
|
||||
When used on strings, the `+` operator is called the concatenation operator:
|
||||
```javascript
|
||||
let text1 = "John";
|
||||
let text2 = "Doe";
|
||||
let text3 = text1 + " " + text2;
|
||||
```
|
||||
The `+=` assignment operator can also concatenate:
|
||||
```javascript
|
||||
let text1 = "What a very ";
|
||||
text1 += "nice day";
|
||||
```
|
||||
|
||||
**Adding Strings and Numbers** [S1]
|
||||
If you add a number and a string, the result will be a string:
|
||||
```javascript
|
||||
let x = 5 + 5;
|
||||
let y = "5" + 5;
|
||||
let z = "Hello" + 5;
|
||||
```
|
||||
|
||||
**JavaScript Assignment Operators** [S1]
|
||||
Assignment operators assign values to JavaScript variables. For example, `x += 5` is the same as `x = x + 5`:
|
||||
```javascript
|
||||
let x = 10;
|
||||
x += 5;
|
||||
```
|
||||
|
||||
| Operator | Example | Same As |
|
||||
|----------|---------|---------|
|
||||
| = | x = y | x = y |
|
||||
| += | x += y | x = x + y |
|
||||
| -= | x -= y | x = x - y |
|
||||
| *= | x *= y | x = x * y |
|
||||
| /= | x /= y | x = x / y |
|
||||
| %= | x %= y | x = x % y |
|
||||
| **= | x **= y | x = x ** y |
|
||||
|
||||
**JavaScript Comparison Operators** [S1]
|
||||
Comparison operators always return `true` or `false`:
|
||||
```javascript
|
||||
let x = 5;
|
||||
let result = x > 8;
|
||||
```
|
||||
|
||||
| Operator | Description | Example |
|
||||
|----------|-------------|---------|
|
||||
| == | equal to | x == 5 |
|
||||
| === | equal value and equal type | x === 5 |
|
||||
| != | not equal | x != 5 |
|
||||
| !== | not equal value or not equal type | x !== 5 |
|
||||
| > | greater than | x > 5 |
|
||||
| < | less than | x < 5 |
|
||||
| >= | greater than or equal to | x >= 5 |
|
||||
| <= | less than or equal to | x <= 5 |
|
||||
|
||||
Strings are compared alphabetically: [S1]
|
||||
```javascript
|
||||
let text1 = "A";
|
||||
let text2 = "B";
|
||||
let result = text1 < text2;
|
||||
```
|
||||
|
||||
**JavaScript Logical Operators** [S1]
|
||||
|
||||
| Operator | Description |
|
||||
|----------|-------------|
|
||||
| && | logical and |
|
||||
| \|\| | logical or |
|
||||
| ! | logical not |
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
The page's own snippets are the canonical applied examples — assigning with `=`, computing with `+`/`*`, concatenating strings, compound-assigning with `+=`, and comparing values/strings. No external project/commit applications found in the source.
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Compute and store a result:
|
||||
```javascript
|
||||
let x = 5;
|
||||
let y = 2;
|
||||
let z = x + y;
|
||||
```
|
||||
Concatenate strings with a separator:
|
||||
```javascript
|
||||
let text3 = text1 + " " + text2;
|
||||
```
|
||||
Compound assignment:
|
||||
```javascript
|
||||
let x = 10;
|
||||
x += 5;
|
||||
```
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
No contradictions found in the source. The behavior that `"5" + 5` yields a string (`"55"`) rather than `10` is intentional, not a contradiction — `+` concatenates when a string operand is present.
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.88
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[JavaScript Tutorial]]
|
||||
- **관련 개념:** [[JavaScript Arithmetic]], [[JavaScript Assignment]], [[JavaScript Comparisons]], [[JavaScript Types]]
|
||||
- **참조 맥락:** The umbrella reference for the operator-family pages (arithmetic, assignment, comparison, logical) that follow it.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — JavaScript Operators — https://www.w3schools.com/js/js_operators.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Operators" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user