CKTIS / JavaScript
BigInt literal
A BigInt literal is an integer written with a lowercase n suffix, such as 42n. It creates a bigint value without the rounding that affects large Number values.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
0n; 42n; 0b101010n; 0o52n; 0x2AnA BigInt literal, such as 42n, creates a primitive value of type bigint, not number. BigInt is part of ECMAScript 2020 and represents integers exactly beyond the safe integer range of Number.
The lowercase n must immediately follow the integer notation. Decimal (42n), binary (0b101010n), octal (0o52n), and hexadecimal (0x2An) forms are supported. 1.5n, 1e3n, and 042n are syntax errors. In -42n, - is a unary operator, not part of the literal.
Arithmetic operations such as + require matching numeric types: 42n + 1n works, but 42n + 1 throws TypeError. BigInt division discards the fractional part toward zero: 7n / 2n produces 3n. Converting a large value to Number can lose precision.
This is language syntax, not a Web API. The runtime must be able to parse it; an unsupported browser cannot execute a file containing such a literal. Having Node 24 in a repository does not establish support in target browsers.
Examples
const value = 9007199254740993n;
console.log(typeof value);
console.log(String(value + 2n));
console.log(String(7n / 2n));
console.log(42n === 0x2An);Result
bigint 9007199254740995 3 true
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.