JS Built-ins
BigIntasUintNintermediate

BigInt.asUintN() β€” 257n wraps to 1n

πŸ“– Usage Example
BigInt.asUintN(1, 3n)  // β†’ 1n

A 1-bit unsigned integer can only represent 0 or 1.

BigInt.asUintN() 257 in 8-bit

BigInt.asUintN(8, 257n) wraps to 1n because 257 = 256 + 1.

Challenge: Verify this wrap.

πŸ’‘ Hints (1)
  • β€’ 257 mod 256 = 1.