JS Built-ins
BigIntasIntNbeginner

BigInt.asIntN() β€” no overflow

πŸ“– Usage Example
BigInt.asIntN(4, 7n)  // β†’ 7n

If the value fits in N bits, asIntN() returns it unchanged.

BigInt.asIntN() Within Range

BigInt.asIntN(8, 127n) returns 127n because 127 fits in a signed 8-bit integer.

Challenge: Verify no overflow occurs.

πŸ’‘ Hints (1)
  • β€’ Values within -128..127 are returned unchanged.