BigInt
BigInt is a numeric primitive that can represent integers with arbitrary precision. It was added in ES2020 to handle numbers larger than 2^53 - 1 (the maximum safe integer for Number).
Create a BigInt by appending n to an integer or using the BigInt() function.
let big = 123456789012345678901234567890n;let alsoBig = BigInt("9007199254740993");Operations:
Arithmetic with BigInt works similarly, but you cannot mix BigInt and regular Number in operations.
let sum = 100n + 200n; // 300n// let mix = 100n + 50; // TypeErrorComparisons (like >, <) work across types.
console.log(100n > 50); // trueDivision truncates toward zero.
console.log(5n / 2n); // 2nBigInt is useful for high‑precision applications (cryptography, large IDs) but not for everyday math due to performance and interoperability concerns.