Standard built-ins

BigInt.asUintN()

Try the free JavaScript compiler

Reduces a BigInt modulo 2^bits as a nonnegative result, without signed interpretation. Width zero yields 0n. An invalid width throws RangeError.

Formal Syntax & Structure

javascript syntaxjavascript
BigInt.asUintN(bits, value)

Parameters & Attributes

NameTypeDescription
bitsnumberNonnegative bit width after index conversion.
valuebigintInput converted using ToBigInt.

Return Value

bigint

Unsigned width-limited result.

Working Example

Example Snippetjavascript
console.log(String(BigInt.asUintN(8,-1n)));
JavaScript Reference