jsguides

Reference

Number

Number type, constants, and parsing functions.

  1. Number.EPSILON

    The difference between 1 and the smallest floating-point number greater than 1 representable in a Number, approximately 2^-52.

  2. Number.isFinite()

    Number.isFinite() returns true for finite numbers, false for Infinity, -Infinity, NaN, and non-number types, without the type coercion of global isFinite().

  3. Number.isInteger()

    Number.isInteger() determines whether a value is a finite integer with no fractional component. Returns false for floats, NaN, Infinity, and non-number types.

  4. Number.isNaN()

    Number.isNaN() tests if a value is exactly NaN without type coercion. Covers the global isNaN() difference, NaN in arithmetic, and the NaN !== NaN quirk.

  5. Number.MAX_SAFE_INTEGER

    `Number.MAX_SAFE_INTEGER` is the largest safe integer in JavaScript (2^53 - 1 = 9,007,199,254,740,991). Upper bound for IEEE-754 doubles that compare exactly.

  6. Number.parseFloat()

    Number.parseFloat() parses a string and returns a floating-point number, identical to the global parseFloat() function. Added in ES6 for global modularization.

  7. Number.parseInt()

    Number.parseInt() parses a string and returns an integer in the given radix. Identical to the global parseInt, exposed on the Number namespace since ES2015.

  8. Number.prototype.toFixed()

    Number.prototype.toFixed() returns a string with fixed decimal places. Essential for currency, percentages, and consistent numeric display.

  9. Number.prototype.toPrecision()

    Number.prototype.toPrecision() formats a number to a specified number of significant digits. Suited for scientific data where precision matters.

  10. Number.prototype.toString()

    Number.prototype.toString() converts a number to a string in any radix from 2 to 36, supporting binary, octal, hex, and custom base representations.