JS Built-ins
BigIntasIntNintermediate

BigInt.asIntN() β€” 128n wraps

πŸ“– Usage Example
BigInt.asIntN(64, 2n ** 63n)  // β†’ -9223372036854775808n

Use asIntN(64, ...) to simulate 64-bit signed integer overflow behavior.

BigInt.asIntN() 128 in 8-bit

BigInt.asIntN(8, 128n) wraps to -128n because 128 is just above the signed 8-bit max.

Challenge: Verify this specific wrap.

πŸ’‘ Hints (1)
  • β€’ Signed 8-bit maximum is 127; 128 becomes -128.