📜  javascript bigint - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:44.789000             🧑  作者: Mango

代码示例3
// There are two ways to create BigInt:

//1. add a suffix n to any number in JavaScript
const big = 1000000n; // 1000000n

//2. call the constructor BigInt(val) and pass in a numerical value
const bigN = BigInt(123) // 123n

//strings also work
const bigS = BigInt("234") // 234n
const bigHex = BigInt("0xffffffffffffffff") // 18446744073709551615n
const bigBin = BigInt("0b111") // 7n