JavaScript Number Methods

What You’ll Learn
JavaScript Number methods help you convert and format numeric values for the UI, APIs, and debugging. This hub indexes 10 tutorials with examples and try-it labs.
toString
Any base
Radix
2–36
Hex / bin
Colors & bits
Display
UI text
Safe
Baseline
10 guides
Growing
Introduction
A JavaScript Number is an IEEE-754 floating-point value. Instance methods live on Number.prototype. Static methods like Number.isFinite(), Number.isInteger(), Number.isNaN(), Number.isSafeInteger(), Number.parseInt(), and Number.parseFloat() are called on Number itself.
Start with toString() to learn decimal strings and optional radix conversion for binary and hex.
👀 Number → String in One Call
The same method adapts to the base you need:
Number Methods Index
Search by method name or browse by category. Each tutorial includes syntax, five try-it examples, and FAQs.
Convert to String
4 tutorialsTurn numbers into text for display, fixed decimals, significant digits, scientific notation, colors, and base conversion.
| Method | Description | Tutorial |
|---|---|---|
toString() | Return a string for a number in base 2–36 — default decimal, binary/hex via radix, keeps the minus sign for negatives. | Open |
toExponential() | Format a number in exponential (scientific) notation — optional fractionDigits 0–100 for mantissa precision. | Open |
toFixed() | Format a number with a fixed count of decimal places — rounds, pads zeros, returns a display string. | Open |
toPrecision() | Format a number to a chosen count of significant digits — may use plain or exponential form. | Open |
Static Methods
6 tutorialsCall on Number itself (not on number instances) to inspect, validate, or parse values.
| Method | Description | Tutorial |
|---|---|---|
isFinite() | Static check: return true only for finite number values — no coercion, rejects Infinity, NaN, and non-numbers. | Open |
isInteger() | Static check: return true only for integer number values — no coercion, rejects floats, Infinity, NaN, and non-numbers. | Open |
isNaN() | Static check: return true only for the number value NaN — no coercion, safer than global isNaN(). | Open |
isSafeInteger() | Static check: return true only for integers in the MAX_SAFE_INTEGER / MIN_SAFE_INTEGER range — no coercion. | Open |
parseInt() | Static parse: turn a string into an integer with optional radix 2–36 — same as global parseInt. | Open |
parseFloat() | Static parse: turn a string into a floating-point number — keeps decimals, same as global parseFloat. | Open |
❓ Frequently Asked Questions
Start with toString()
Learn decimal strings, binary, hex, and base conversion.
6 people found this page helpful
