EN
JavaScript - get max supported integer value
3
points
In this article, we would like to show you how to get supported max integer value in JavaScript.
Quick solution:
JavaScript supports 53 bits integer numbers when we work on number type.
9007199254740991
(in dec)===
11111111111111111111111111111111111111111111111111111
(in bin)
const maxValue = Number.MAX_SAFE_INTEGER; // 9007199254740991
Practical example
In this example, we print in the console the Number.MAX_SAFE_INTEGER
constant that represents the maximum safe integer in JavaScript.
// ONLINE-RUNNER:browser;
console.log(Number.MAX_SAFE_INTEGER); // 9007199254740991
Output:
9007199254740991