JavaScript Number Methods

About This Index
This page is the JavaScript Number Methods index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.
Learn what a Number is on /js/number. Use this page when you need a specific API such as toFixed(), toLocaleString(), toString(), or isInteger().
Start with toFixed(), toLocaleString(), toString(), isInteger(), and parseInt()—then browse the rest by category.
How to Call a Number Method
Instance methods use a dot; static helpers use Number:
const n = 3.14159;
const rgb = 255;
// Instance (Number.prototype)
n.toFixed(2); // "3.14"
n.toLocaleString("en-US"); // "3.142"
rgb.toString(16); // "ff"
n.toPrecision(3); // "3.14"
n.toExponential(2); // "3.14e+0"
(new Number(7)).valueOf(); // 7
// Static (on Number)
Number.isInteger(5); // true
Number.isNaN(NaN); // true
Number.parseInt("42", 10); // 42
Number.parseFloat("3.14"); // 3.14 JavaScript Number Methods Table
All method guides in this JavaScript tutorial series (12 tutorials).
Convert to String
5 methodsTurn 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. | Try it |
toExponential() | Format a number in exponential (scientific) notation — optional fractionDigits 0–100 for mantissa precision. | Try it |
toFixed() | Format a number with a fixed count of decimal places — rounds, pads zeros, returns a display string. | Try it |
toLocaleString() | Format a number for a language or region — grouping, currency, percent, and locale decimal marks. | Try it |
toPrecision() | Format a number to a chosen count of significant digits — may use plain or exponential form. | Try it |
Static Methods
6 methodsCall 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. | Try it |
isInteger() | Static check: return true only for integer number values — no coercion, rejects floats, Infinity, NaN, and non-numbers. | Try it |
isNaN() | Static check: return true only for the number value NaN — no coercion, safer than global isNaN(). | Try it |
isSafeInteger() | Static check: return true only for integers in the MAX_SAFE_INTEGER / MIN_SAFE_INTEGER range — no coercion. | Try it |
parseInt() | Static parse: turn a string into an integer with optional radix 2–36 — same as global parseInt. | Try it |
parseFloat() | Static parse: turn a string into a floating-point number — keeps decimals, same as global parseFloat. | Try it |
Object Helpers
1 methodWork with Number objects and primitives — unwrap wrappers when needed.
Frequently Asked Questions
Start with toFixed()
Open the formatting guide—syntax, examples, and FAQs.
CODETOFUN NEWS
Stay Ahead in Tech
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
10 people found this page helpful
