For larger integers, consider using
|Property attributes of
MAX_SAFE_INTEGER constant has a value of
Safe in this context refers to the ability to represent integers exactly and to correctly compare them. For example,
Number.MAX_SAFE_INTEGER + 1 === Number.MAX_SAFE_INTEGER + 2 will evaluate to true, which is mathematically incorrect. See
Number.isSafeInteger() for more information.
This field does not exist in old browsers. Using it without checking its existence, such as
Math.max(Number.MAX_SAFE_INTEGER, 2), will yield undesired results such as NaN.
Number.MAX_SAFE_INTEGER; // 9007199254740991
This returns 2 because in floating points, the value is actually the decimal trailing "1" except for in subnormal precision cases such as zero.
Number.MAX_SAFE_INTEGER * Number.EPSILON; // 2
|ECMAScript Language Specification |
BCD tables only load in the browser