Standard built-ins
BigInt.asIntN()
Reduces a BigInt modulo 2^bits and interprets the result as a signed two-complement integer of that width. bits uses index conversion; an invalid width throws RangeError. Width zero yields 0n.
Formal Syntax & Structure
javascript syntaxjavascript
BigInt.asIntN(bits, value)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| bits | number | Nonnegative bit width after index conversion. |
| value | bigint | Input converted using ToBigInt. |
Return Value
bigint
Signed width-limited result.
Working Example
Example Snippetjavascript
console.log(String(BigInt.asIntN(8,255n)));