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,165 @@
|
||||
---
|
||||
id: javascript-primitive-data-types
|
||||
title: "JavaScript Primitive Data Types"
|
||||
category: "Frontend"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["JS primitives", "primitive types", "string number boolean", "undefined null", "BigInt"]
|
||||
duplicate_of: ""
|
||||
source_trust_level: "B"
|
||||
confidence_score: 0.89
|
||||
created_at: 2026-06-23
|
||||
updated_at: 2026-06-23
|
||||
review_reason: ""
|
||||
merge_history: []
|
||||
tags: ["javascript", "js", "web", "frontend", "w3schools", "primitives", "data-types", "string", "number"]
|
||||
raw_sources: ["https://www.w3schools.com/js/js_datatypes_primitives.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[JavaScript Primitive Data Types]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
JavaScript has 7 primitive data types — Number, BigInt, String, Boolean, Undefined, Null, and Symbol — each a simple, immutable value distinct from the single object type. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **7 primitive types** — JavaScript variables can hold 7 primitive types (Number, BigInt, String, Boolean, Undefined, Null, Symbol) or 1 object type. [S1]
|
||||
- **Strings** — a string is a series of characters, written with single or double quotes. [S1]
|
||||
- **Numbers are 64-bit floats** — all JavaScript numbers are stored as double (64-bit floating point) values; they support decimals and exponential notation. [S1]
|
||||
- **BigInt (ES2020)** — handles integers too large for standard numbers. [S1]
|
||||
- **Undefined vs Null** — a variable without a value is `undefined`; `null` represents the intentional absence of a value, but `typeof null` returns `"object"` (a historical quirk). [S1]
|
||||
|
||||
## 🧩 추출된 패턴 (Extracted patterns)
|
||||
- **Nest opposite quotes** — put single quotes inside double-quoted strings (and vice versa) to avoid escaping. [S1]
|
||||
- **`===` vs `==` for null/undefined** — strict equality (`===`) is `true` only when value and type match; loose equality (`==`) treats `null` and `undefined` as equal. [S1]
|
||||
- **Empty string is still a string** — `let car = "";` has value `""` and `typeof "string"`. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
JavaScript variables can hold 8 types of data: 7 primitive types or 1 object type. The primitive types are: Number, BigInt, String, Boolean, Undefined, Null, and Symbol. [S1]
|
||||
|
||||
**JavaScript Strings**
|
||||
A string is a series of characters like "John Doe", written with single or double quotes. [S1]
|
||||
```javascript
|
||||
// Using double quotes:
|
||||
let carName1 = "Volvo XC60";
|
||||
|
||||
// Using single quotes:
|
||||
let carName2 = 'Volvo XC60';
|
||||
```
|
||||
You can nest the opposite quote type inside a string: [S1]
|
||||
```javascript
|
||||
// Single quote inside double quotes:
|
||||
let answer1 = "It's alright";
|
||||
|
||||
// Single quotes inside double quotes:
|
||||
let answer2 = "He is called 'Johnny'";
|
||||
|
||||
// Double quotes inside single quotes:
|
||||
let answer3 = 'He is called "Johnny"';
|
||||
```
|
||||
|
||||
**JavaScript Numbers**
|
||||
All JavaScript numbers are stored as decimal (floating point) values — always double (64-bit floating point). [S1]
|
||||
```javascript
|
||||
// With decimals:
|
||||
let x1 = 34.00;
|
||||
|
||||
// Without decimals:
|
||||
let x2 = 34;
|
||||
```
|
||||
Exponential notation: [S1]
|
||||
```javascript
|
||||
let y = 123e5; // 12300000
|
||||
let z = 123e-5; // 0.00123
|
||||
```
|
||||
|
||||
**JavaScript BigInt**
|
||||
BigInt (ES2020) handles integers too large for standard numbers: [S1]
|
||||
```javascript
|
||||
let x = BigInt("123456789012345678901234567890");
|
||||
```
|
||||
|
||||
**JavaScript Booleans**
|
||||
Booleans can only hold `true` or `false`: [S1]
|
||||
```javascript
|
||||
let x = 5;
|
||||
let y = 5;
|
||||
let z = 6;
|
||||
(x == y) // Returns true
|
||||
(x == z) // Returns false
|
||||
```
|
||||
|
||||
**The `typeof` Operator**
|
||||
The `typeof` operator identifies a variable's type. [S1]
|
||||
```javascript
|
||||
typeof "" // Returns "string"
|
||||
typeof "John" // Returns "string"
|
||||
typeof "John Doe" // Returns "string"
|
||||
```
|
||||
```javascript
|
||||
typeof 0 // Returns "number"
|
||||
typeof 314 // Returns "number"
|
||||
typeof 3.14 // Returns "number"
|
||||
typeof (3) // Returns "number"
|
||||
typeof (3 + 4) // Returns "number"
|
||||
```
|
||||
|
||||
**Undefined**
|
||||
A variable without a value has the value `undefined` and the type `undefined`: [S1]
|
||||
```javascript
|
||||
let car; // Value is undefined, type is undefined
|
||||
```
|
||||
```javascript
|
||||
car = undefined; // Value is undefined, type is undefined
|
||||
```
|
||||
|
||||
**Empty Values**
|
||||
An empty string has both a legal value and a type: [S1]
|
||||
```javascript
|
||||
let car = ""; // The value is "", the typeof is "string"
|
||||
```
|
||||
|
||||
**Datatype null**
|
||||
`null` represents "nothing" — the intentional absence of a value: [S1]
|
||||
```javascript
|
||||
let carName = null;
|
||||
```
|
||||
Notes on `null`: the `typeof` operator returns `"object"` for `null` (a historical quirk); the strict equality operator `===` returns `true` only if both value and type match; the loose equality operator `==` returns `true` for both `null` and `undefined`. [S1]
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
The page's own declarations (string quoting variants, number/exponent/BigInt literals, boolean comparisons, and the undefined/empty/null examples) are the canonical applied examples. No external project/commit applications found in the source.
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Nest opposite quotes (language: JavaScript):
|
||||
```javascript
|
||||
let answer1 = "It's alright";
|
||||
let answer3 = 'He is called "Johnny"';
|
||||
```
|
||||
Exponential number notation:
|
||||
```javascript
|
||||
let y = 123e5; // 12300000
|
||||
let z = 123e-5; // 0.00123
|
||||
```
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
`typeof null` returns `"object"` even though `null` is a primitive value — the page flags this as a historical quirk. BigInt was introduced in ES2020. [S1]
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.89
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[JavaScript Tutorial]]
|
||||
- **관련 개념:** [[JavaScript Data Types]], [[JavaScript Object Data Types]], [[JavaScript typeof]], [[JavaScript Symbols]]
|
||||
- **참조 맥락:** Referenced whenever declaring simple values or reasoning about equality and `typeof` results.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — JavaScript Primitive Data Types — https://www.w3schools.com/js/js_datatypes_primitives.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Primitive Data Types" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user