JS: bigint constructor

By Xah Lee. Date: .
xtodo

BigInt() constructor

// string to bigint
const xbig1 = BigInt("123456789012345678901234567890");
console.log( xbig1 )
// 123456789012345678901234567890n

// number to bigint. the number must be less than Number.MAX_SAFE_INTEGER
const xbig2 = BigInt(123);
console.log( xbig2 )
// 123n

console.log( Number.MAX_SAFE_INTEGER )
// 9007199254740991