BigInt: Arbitrary-Precision Integers
The BigInt type, introduced in ES2020, allows JavaScript to represent and operate on integers of arbitrary size, removing the 2^53 − 1 ceiling imposed by the Number type. It is essential for cryptography, working with database IDs that exceed safe integer range, and any domain requiring exact large-integer arithmetic.
Creating BigInt Values
Append n to an integer literal (9007199254740992n), or call BigInt(value) with a number or numeric string. You cannot use a float literal — 3.14n is a syntax error.
Arithmetic
BigInt supports +, -, *, / (integer division), %, and **. You cannot mix BigInt and Number in arithmetic — you must explicitly convert one side.
Comparisons
BigInt and Number can be compared with == (loose equality, which coerces) and with <, > etc., but not with === across types.