MAX_SAFE_INTEGER
The largest whole number, 9007199254740991, that a JavaScript number can store exactly.
In more detail
Beyond it, consecutive integers can no longer all be represented, so 9007199254740993 silently becomes 9007199254740992. IDs and counts that can grow larger should use bigint or strings.
Related terms
- number (type) — The type of ordinary numeric values in JavaScript, both whole numbers and decimals, stored as 64-bit floating-point numbers.
- bigint — A primitive type for whole numbers of any size, written with an n suffix such as 9007199254740993n.
- floating-point number — A number with a fractional part stored in binary, which can only approximate most decimal values.
Taught in
- Primitive Types: String, Number, Boolean, Bigint And Symbol — Production TypeScript