Number Static Properties

The constants on Number describe the limits of the double format. The safe integers are those that can be represented exactly and distinguished from their neighbors; beyond 2^53 - 1 the gap between adjacent doubles exceeds 1, so MAX_SAFE_INTEGER + 1 and + 2 become the same number.

Number static properties
Property Value Meaning
MAX_SAFE_INTEGER 9007199254740991 2^53 - 1, largest exact integer
MIN_SAFE_INTEGER -9007199254740991 -(2^53 - 1)
MAX_VALUE 1.7976931348623157e+308 largest finite number
MIN_VALUE 5e-324 smallest positive number (not the most negative)
EPSILON 2.220446049250313e-16 gap between 1 and the next double
POSITIVE_INFINITY, NEGATIVE_INFINITY, NaN Infinity, -Infinity, NaN same as the globals
Hitting the limits of a doubleJavaScriptLive
const big = Number.MAX_SAFE_INTEGER;
console.log(big, big + 1 === big + 2);
console.log(Number.MAX_VALUE * 2, -Number.MAX_VALUE * 2, Number.MIN_VALUE / 2);
console.log(0.1 + 0.2 === 0.3, Math.abs(0.1 + 0.2 - 0.3) < Number.EPSILON);
console.log(NaN === NaN, Object.is(NaN, NaN), 0 === -0, Object.is(0, -0), 1 / -0);

Overflow gives Infinity and underflow gives 0; neither throws. NaN is the only value unequal to itself, so test it with Number.isNaN() or Object.is(). EPSILON suits values near 1 only; for large magnitudes use a relative tolerance. 64-bit IDs from databases and APIs can exceed 2^53: keep them as strings or BigInts.