Member-only story
BigInt, Arithmetic Operators, and the String Concatenation Trap Nobody Warns You About
JavaScript numbers look infinite. They are not, and the gap between those two things is exactly where this whole topic lives.
The number JavaScript can’t be trusted with
There’s a property sitting on the built-in Number class — not a function, you don't call it, just a value — you read off it called MAX_SAFE_INTEGER.
console.log(Number.MAX_SAFE_INTEGER); // 9007199254740991That’s the largest integer JS can represent safely. Meaning every whole number up to that point is exact, guaranteed. Past it, things get weird in a way that’s easy to miss too, because JS doesn’t throw anything at you. It just quietly hands back the wrong number and moves on like nothing happened.
let myNum = 9007199254740993;
console.log(myNum); // 9007199254740992And it’s not even garbage — off by exactly 1, rounded to the nearest number it can actually represent. Which honestly might be worse? Because it looks plausible. Unless you’re specifically checking for this, you’d never catch it.
Enter BigInt
For anything past that ceiling, JS gives you a whole separate type: BigInt. You make one by sticking an n on the…






