---
id: javascript-math
title: "JavaScript Math"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["Math object", "Math.round", "Math.PI", "Math methods", "Math.pow", "Math.random"]
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", "math", "numbers"]
raw_sources: ["https://www.w3schools.com/js/js_math.asp"]
applied_in: []
github_commit: ""
---

# [[JavaScript Math]]

## 🎯 한 줄 통찰 (One-line insight)
The JavaScript `Math` object provides mathematical constants (like `Math.PI`, `Math.E`) and methods (rounding, powers, roots, trig, min/max, random) that operate on numbers without needing to be instantiated. [S1]

## 🧠 핵심 개념 (Core concepts)
- **`Math` is a static object** — it exposes constants and methods directly (e.g. `Math.PI`, `Math.round(x)`), not via instances. [S1]
- **Rounding family** — `round` (nearest integer), `ceil` (up), `floor` (down), and `trunc` (integer part). [S1]
- **`Math.sign(x)`** returns whether `x` is negative, null, or positive. [S1]
- **Powers and roots** — `Math.pow(x, y)` is x to the power y; `Math.sqrt(x)` is the square root. [S1]
- **`Math.abs(x)`** returns the absolute (positive) value. [S1]
- **Trig** — `Math.sin(x)` / `Math.cos(x)` take an angle in radians (convert from degrees with `* Math.PI / 180`). [S1]
- **`Math.min()` / `Math.max()`** find the lowest / highest value in a list of arguments. [S1]
- **`Math.random()`** returns a random number between 0 (inclusive) and 1 (exclusive). [S1]

## 🧩 추출된 패턴 (Extracted patterns)
- **Degrees → radians** — multiply by `Math.PI / 180` before passing to `Math.sin`/`Math.cos`. [S1]
- **Rounding choice** — pick `round`/`ceil`/`floor`/`trunc` per the rounding behavior you need. [S1]
- **Min/max over a list** — call `Math.min(...)`/`Math.max(...)` with multiple numeric arguments. [S1]

## 📖 세부 내용 (Details)
**The Math Object** — The `Math` object allows you to perform mathematical tasks on numbers. Unlike other objects, the `Math` object has no constructor; it is static and its methods and properties are accessed directly. [S1]

**Math Properties (constants)** — [S1]

| Property | Description |
|----------|-------------|
| `Math.E` | Returns Euler's number |
| `Math.PI` | Returns PI |
| `Math.SQRT2` | Returns the square root of 2 |
| `Math.SQRT1_2` | Returns the square root of 1/2 |
| `Math.LN2` | Returns the natural logarithm of 2 |
| `Math.LN10` | Returns the natural logarithm of 10 |
| `Math.LOG2E` | Returns base 2 logarithm of E |
| `Math.LOG10E` | Returns base 10 logarithm of E |

**Math Methods** — selected methods documented on the page: [S1]

| Method | Description |
|--------|-------------|
| `Math.round(x)` | Returns x rounded to its nearest integer |
| `Math.ceil(x)` | Returns x rounded up to its nearest integer |
| `Math.floor(x)` | Returns x rounded down to its nearest integer |
| `Math.trunc(x)` | Returns the integer part of x |
| `Math.sign(x)` | Returns if x is negative, null or positive |
| `Math.pow(x, y)` | Returns the value of x to the power of y |
| `Math.sqrt(x)` | Returns the square root of x |
| `Math.abs(x)` | Returns the absolute (positive) value of x |
| `Math.sin(x)` | Returns the sine of the angle x |
| `Math.cos(x)` | Returns the cosine of the angle x |
| `Math.min()` | Can be used to find the lowest value in a list |
| `Math.max()` | Can be used to find the highest value in a list |
| `Math.random()` | Returns a random number between 0 (inclusive), and 1 (exclusive) |
| `Math.log(x)` | Returns the natural logarithm of x |
| `Math.log2(x)` | Returns the base 2 logarithm of x |
| `Math.log10(x)` | Returns the base 10 logarithm of x |

**Example expressions and their results** — as shown on the page: [S1]

| Expression | Result |
|------------|--------|
| `Math.round(4.6)` | 5 |
| `Math.round(4.5)` | 4 |
| `Math.round(4.4)` | 4 |
| `Math.ceil(4.9)` | 5 |
| `Math.floor(4.9)` | 4 |
| `Math.trunc(4.9)` | 4 |
| `Math.sign(-4)` | -1 |
| `Math.pow(8, 2)` | 64 |
| `Math.sqrt(64)` | 8 |
| `Math.abs(-4.7)` | 4.7 |
| `Math.sin(90 * Math.PI / 180)` | 1 |
| `Math.cos(0 * Math.PI / 180)` | 1 |
| `Math.min(0, 150, 30, 20, -8, -200)` | -200 |
| `Math.max(0, 150, 30, 20, -8, -200)` | 150 |
| `Math.random()` | A number between 0 (inclusive) and 1 (exclusive) |

> Note: The full source presents these expressions inside interactive "Try it Yourself" Example boxes. The expressions and results above are reproduced from the page; any code that exists only inside the Try-it editor without a printed expression is "Not found in source".

## 🛠️ 적용 사례 (Applied in summary)
The page's own snippets are the canonical applied examples — rounding 4.x values, computing `Math.pow(8, 2)`, taking `Math.sqrt(64)`, converting degrees to radians for `Math.sin`/`Math.cos`, and finding min/max over a list. No external project/commit applications found in the source.

## 💻 코드 패턴 (Code patterns)
Round to nearest / up / down / truncate:
```javascript
Math.round(4.6);  // 5
Math.ceil(4.9);   // 5
Math.floor(4.9);  // 4
Math.trunc(4.9);  // 4
```
Power, square root, absolute value:
```javascript
Math.pow(8, 2);   // 64
Math.sqrt(64);    // 8
Math.abs(-4.7);   // 4.7
```
Degrees to radians for trig:
```javascript
Math.sin(90 * Math.PI / 180);  // 1
Math.cos(0 * Math.PI / 180);   // 1
```
Min / max over a list:
```javascript
Math.min(0, 150, 30, 20, -8, -200);  // -200
Math.max(0, 150, 30, 20, -8, -200);  // 150
```

## ⚖️ 모순 및 업데이트 (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 Random]], [[JavaScript Numbers]], [[JavaScript Array Sort]]
- **참조 맥락:** Referenced whenever numeric computation, rounding, or randomness is needed.

## 📚 출처 (Sources)
- [S1] W3Schools — JavaScript Math — https://www.w3schools.com/js/js_math.asp

## 📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Math" page (Astra wiki-curation, P-Reinforce v3.1 format).
