JS Built-ins
BigIntasUintNintermediate

BigInt.asUintN() β€” wraps to 0

πŸ“– Usage Example
BigInt.asUintN(8, 256n)  // β†’ 0n (wraps as unsigned 8-bit)

BigInt.asUintN() wraps a BigInt to fit within an unsigned N-bit integer.

BigInt.asUintN(width, bigint)

Wraps a BigInt to an unsigned N-bit integer. BigInt.asUintN(8, 256n) wraps to 0n because 256 overflows unsigned 8-bit.

Challenge: Verify this wrap.

πŸ’‘ Hints (1)
  • β€’ Unsigned 8-bit max is 255; 256 wraps to 0.