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,238 @@
---
id: javascript-number-methods
title: "JavaScript Number Methods"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["number methods", "toFixed", "toPrecision", "Number()", "parseInt", "parseFloat"]
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", "numbers", "number-methods", "parsing"]
raw_sources: ["https://www.w3schools.com/js/js_number_methods.asp"]
applied_in: []
github_commit: ""
---
# [[JavaScript Number Methods]]
## 🎯 한 줄 통찰 (One-line insight)
Basic number methods (`toString`, `toExponential`, `toFixed`, `toPrecision`, `valueOf`) work on any number, while static `Number.*` methods (`isInteger`, `isFinite`, `isNaN`, `isSafeInteger`, `parseInt`, `parseFloat`) can only be used on `Number` itself. [S1]
## 🧠 핵심 개념 (Core concepts)
- **Basic methods work on any number** — `toString()`, `toExponential()`, `toFixed()`, `toPrecision()`, `valueOf()`. [S1]
- **Static methods only on `Number`** — `Number.isFinite()`, `Number.isInteger()`, `Number.isNaN()`, `Number.isSafeInteger()`, `Number.parseInt()`, `Number.parseFloat()`. [S1]
- **`toString()`** — returns a number as a string; accepts a radix. [S1]
- **`toFixed()`** — returns a string with a specified number of decimals; perfect for working with money. [S1]
- **`toPrecision()`** — returns a string with a number written to a specified length. [S1]
- **Conversion functions** — `Number()`, `parseInt()`, `parseFloat()` convert variables to numbers; `NaN` is returned when conversion fails. [S1]
- **Methods cannot be used on variables for statics** — `Number.isInteger()` etc. must be called on `Number`; calling on a variable throws a TypeError. [S1]
- **Safe integers** — range is -(2⁵³ - 1) to +(2⁵³ - 1); `9007199254740991` is safe, `9007199254740992` is not. [S1]
## 🧩 추출된 패턴 (Extracted patterns)
- **Format money** — `value.toFixed(2)` to render two decimal places. [S1]
- **Parse leading number from text** — `parseInt("10 years")` / `parseFloat("10.33")` extract a number from the front of a string. [S1]
- **Validate before use** — `Number.isInteger()` / `Number.isSafeInteger()` / `Number.isNaN()` to check values. [S1]
## 📖 세부 내용 (Details)
**Basic Methods** can be used on any number: `toString()`, `toExponential()`, `toFixed()`, `toPrecision()`, `valueOf()`. **Static Methods** can only be used on `Number`: `Number.isFinite()`, `Number.isInteger()`, `Number.isNaN()`, `Number.isSafeInteger()`, `Number.parseInt()`, `Number.parseFloat()`. [S1]
**toString()** — returns a number as a string; can take a radix. [S1]
```javascript
let x = 123;
x.toString();
(123).toString();
(100 + 23).toString();
```
```javascript
let x = 123;
let text = x.toString(2);
```
**toExponential()** — returns a string with a number rounded and written using exponential notation. [S1]
```javascript
let x = 9.656;
x.toExponential(2);
x.toExponential(4);
x.toExponential(6);
```
**toFixed()** — returns a string with the number written with a specified number of decimals; perfect for working with money. [S1]
```javascript
let x = 9.656;
x.toFixed(0);
x.toFixed(2);
x.toFixed(4);
x.toFixed(6);
```
**toPrecision()** — returns a string with a number written with a specified length. [S1]
```javascript
let x = 9.656;
x.toPrecision();
x.toPrecision(2);
x.toPrecision(4);
x.toPrecision(6);
```
**valueOf()** — returns a number as a number; used internally in JavaScript to convert Number objects to primitive values. [S1]
```javascript
let x = 123;
x.valueOf();
(123).valueOf();
(100 + 23).valueOf();
```
**Converting Variables to Numbers** — three methods are available: [S1]
| Method | Description |
|--------|-------------|
| Number() | Converts argument to number |
| parseFloat() | Parses argument, returns floating point |
| parseInt() | Parses argument, returns whole number |
**Number()** — converts its argument to a number. [S1]
```javascript
Number(true);
Number(false);
Number("10");
Number(" 10");
Number("10 ");
Number(" 10 ");
Number("10.33");
Number("10,33");
Number("10 33");
Number("John");
```
**Number() Used on Dates** — converts a date to milliseconds. [S1]
```javascript
Number(new Date("1970-01-01"))
```
```javascript
Number(new Date("1970-01-02"))
```
```javascript
Number(new Date("2017-09-30"))
```
**parseInt()** — parses and returns a whole number. [S1]
```javascript
parseInt("-10");
parseInt("-10.33");
parseInt("10");
parseInt("10.33");
parseInt("10 20 30");
parseInt("10 years");
parseInt("years 10");
```
**parseFloat()** — parses and returns a floating point number. [S1]
```javascript
parseFloat("10");
parseFloat("10.33");
parseFloat("10 20 30");
parseFloat("10 years");
parseFloat("years 10");
```
**Number Object Methods** (static): [S1]
| Method | Description |
|--------|-------------|
| Number.isInteger() | Returns true if argument is integer |
| Number.isNaN() | Returns true if argument is NaN |
| Number.isFinite() | Returns true if not Infinity or NaN |
| Number.isSafeInteger() | Returns true if safe integer |
| Number.parseFloat() | Converts string to number |
| Number.parseInt() | Converts string to whole number |
Number methods can only be accessed like `Number.isInteger()`; calling them on a variable produces a TypeError ("X.isInteger is not a function"). `Number.isNaN()` is the preferred way to check for equality with NaN. [S1]
**Number.isInteger()** [S1]
```javascript
Number.isInteger(10);
Number.isInteger(10.5);
```
**Number.isFinite()** [S1]
```javascript
Number.isFinite(123);
```
**Number.isNaN()** [S1]
```javascript
Number.isNaN(123);
```
**Number.isSafeInteger()** — safe integer range is -(2⁵³ - 1) to +(2⁵³ - 1). [S1]
```javascript
Number.isSafeInteger(10);
Number.isSafeInteger(12345678901234567890);
```
**Number.parseFloat()** [S1]
```javascript
Number.parseFloat("10");
Number.parseFloat("10.33");
Number.parseFloat("10 20 30");
Number.parseFloat("10 years");
Number.parseFloat("years 10");
```
**Number.parseInt()** [S1]
```javascript
Number.parseInt("-10");
Number.parseInt("-10.33");
Number.parseInt("10");
Number.parseInt("10.33");
Number.parseInt("10 20 30");
Number.parseInt("10 years");
Number.parseInt("years 10");
```
## 🛠️ 적용 사례 (Applied in summary)
The page's own snippets are the canonical applied examples — formatting `9.656` with `toFixed`/`toPrecision`/`toExponential`, converting strings and dates with `Number()`, parsing with `parseInt`/`parseFloat`, and validating with the static `Number.*` methods. No external project/commit applications found in the source.
## 💻 코드 패턴 (Code patterns)
Format for money:
```javascript
let x = 9.656;
x.toFixed(2);
```
Parse a number from text:
```javascript
parseInt("10 years");
parseFloat("10.33");
```
Validate a value:
```javascript
Number.isInteger(10);
Number.isSafeInteger(9007199254740991);
```
## ⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
- **`Number()` vs `parseInt()` vs `parseFloat()`** — `Number()` converts the whole argument (returns NaN if it is not fully numeric, e.g. `"10 33"`); `parseInt()` returns a whole number from the leading numeric portion; `parseFloat()` returns a floating point from the leading numeric portion. [S1]
- **Basic vs static methods** — basic methods (`toFixed`, etc.) are called on a number value; static methods (`Number.isInteger`, etc.) must be called on `Number` itself or they throw a TypeError. [S1]
- **`Number.isNaN()` is preferred** for checking equality with NaN. [S1]
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
No contradictions found in the source.
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.89
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[JavaScript Tutorial]]
- **관련 개념:** [[JavaScript Numbers]], [[JavaScript Number Properties]], [[JavaScript Data Types]], [[JavaScript Operators]]
- **참조 맥락:** Referenced whenever formatting numbers for display or converting strings/dates into numeric values.
## 📚 출처 (Sources)
- [S1] W3Schools — JavaScript Number Methods — https://www.w3schools.com/js/js_number_methods.asp
## 📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Number Methods" page (Astra wiki-curation, P-Reinforce v3.1 format).