BigInt and Numeric Separators
Use BigInt for whole numbers past Number’s safe range, and underscores to make large literals readable.
Number cannot represent every integer exactly above
Number.MAX_SAFE_INTEGER (9_007_199_254_740_991).
BigInt literals end with n. You cannot mix BigInt and Number with + without converting.
Results appear here.
Important JavaScript
const safeMax = Number.MAX_SAFE_INTEGER; // 9_007_199_254_740_991
const asNumber = 9007199254740993; // loses exactness
const asBigInt = 9007199254740993n; // exact
const million = 1_000_000;
const budget = 12_500_000n;
// Mixed arithmetic throws — convert first:
Number(asBigInt) + 1;
asBigInt + BigInt(1);