Computer >> Computer tutorials >  >> Programming >> Javascript

What is JavaScript’s highest integer value that a Number can go to without losing precision?


Short answer: +/- 9007199254740991

According to the ES6 specification, all the positive and negative integers whose magnitude is no greater than 2^53 are representable in the Number type (indeed, the integer 0 has two representations, +0 and −0). In ES6, this is defined as Number.MAX_SAFE_INTEGER.

Note that the bitwise operators and shift operators operate on 32-bit ints, so in that case, the max safe integer is 2^31-1, or 2147483647.