Max Safe Integer Limit
9007199254740991

Try adding 2. The result stays the same!
Regular Numbers lose precision after 253 - 1.

const max = Number.MAX_SAFE_INTEGER;
console.log(max + 2); // Wrong!

The Safe Limit

Regular JavaScript numbers are accurate only up to 9 quadrillion (9,007,199,254,740,991). Go beyond this, and math starts to break!

BigInt to the Rescue

BigInt is a special type used for arbitrarily large integers. You create one by appending 'n' to the end of an integer literal.

Strict Operations

BigInt is strict. You cannot mix it with regular numbers. You must explicitly convert types or use BigInts on both sides of an operation.

Infinite Math!

You can now calculate numbers larger than the universe.
Ready to compare them?

AlgoAnimator: Interactive Data Structures