The JavatoString()
BigInt method returns a string for BigInt object.
The trailing "n" is not part of the string.
bigIntObj.toString([radix])
Parameters | Optional | Meaning |
---|---|---|
radix | Optional | An integer in the range 2 through 36. |
The radix
sets the base to use for representing BigInt value.
If the radix is not specified, the preferred radix is assumed to be 10.
Using toString
console.log(17n.toString());/*from w w w . j a v a2 s .co m*/ console.log(66n.toString(2)); console.log(254n.toString(16)); console.log(-10n.toString(2)); console.log(-0xffn.toString(2));