JavaScript uses a fixed number of bits, 64 of them, to store a single number value. There are only so many patterns you can make with 64 bits, which means that the number of different numbers that can be represented is limited. With N decimal digits, you can represent 10^N numbers. Similarly, given 64 binary digits, you can represent 2^64 different numbers, which is about 18 quintillion (an 18 with 18 zeros after it).
Javascript traditionally stores numbers as a 64 bit floating point with a 52 bit mantissa an 11 bit exponent and the sign is 1 bit. Effectively this means that
Integers are accurate up to 15 digits. -- w3schools.com
Now with ES6 the BigInt proposal has been finalized, so you can access a second type of number when dealing with integers that may be larger than 52 bits. There also exist some libraries for operations on large numbers provided as strings.