Files
2nd/10_Wiki/Topic_JavaScript/JavaScript_Math.md
T
koriweb 9609c04755 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>
2026-06-23 19:21:18 +09:00

6.5 KiB

id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
id title category status verification_status canonical_id aliases duplicate_of source_trust_level confidence_score created_at updated_at review_reason merge_history tags raw_sources applied_in github_commit
javascript-math JavaScript Math Frontend draft conceptual
Math object
Math.round
Math.PI
Math methods
Math.pow
Math.random
B 0.88 2026-06-23 2026-06-23
javascript
js
web
frontend
w3schools
math
numbers
https://www.w3schools.com/js/js_math.asp

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 familyround (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 rootsMath.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]
  • TrigMath.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:

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:

Math.pow(8, 2);   // 64
Math.sqrt(64);    // 8
Math.abs(-4.7);   // 4.7

Degrees to radians for trig:

Math.sin(90 * Math.PI / 180);  // 1
Math.cos(0 * Math.PI / 180);   // 1

Min / max over a list:

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)

📚 출처 (Sources)

📝 변경 이력 (Change history)

  • 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Math" page (Astra wiki-curation, P-Reinforce v3.1 format).