freecoding.school100% FREE · NO SIGNUP
Script SpringsISSUE #10 of 29

bigint · arbitrary precision

SparkyVSNaN the Trickster
Sparky saysBigInt holds integers beyond the safe-integer limit — written with an n suffix.

When you need integers larger than 2^53 (IDs, cryptography, big counters), use BigInt: 9007199254740993n or BigInt(x). BigInts are exact at any size but can't mix with regular numbers in math without explicit conversion, and they have no decimals.

Power-ups you unlock

NaN the Trickster attacks — common mistakes

Boss battleAdd two BigInts past the safe-integer limit and show the exact result.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre id="o"></pre>
<script>const big = 9007199254740991n + 10n;
document.getElementById('o').textContent = 'exact: ' + big;</script></body></html>
▶ Open the interactive comic issue
‹ Number Methods · ToFixed · ParseInt · IsFiniteStrings · Single · Double · Backtick ›