Javascript BigInt asUintN()

Introduction

The Javascript BigInt.asUintN() static method converts a BigInt value to an unsigned integer.

BigInt.asUintN(width, bigint);
Parameter Meaning
width The amount of bits available for the integer size.
bigintThe big integer.

The BigInt.asUintN() method can stay in the range of 64-bit arithmetic.

const max = 2n ** 64n - 1n;//from   w w  w  .  j a  va 2s  .c  om

let a = BigInt.asUintN(64, max);
console.log(a);

a = BigInt.asUintN(64, max + 1n);
console.log(a);



PreviousNext

Related