BigInt API

Working with arbitrary-precision integers.

BigInt is a primitive wrapper object used to represent and manipulate primitive bigint values - which are too large to be represented by the number primitive.

A BigInt is created by appending n to the end of an integer literal, or by calling the BigInt() function. It can represent integers of arbitrary magnitude, and is helpful for working with very large numbers where precision is important, such as when working with large timestamps, large IDs, or in cryptographic applications.

6 Total 6 Methods 0 Properties 3 Statics
  Show all

BigInt(…)

Creates a BigInt value.BigInt([value])

BigInt.asIntN(…)

Wraps a BigInt value to a signed integer between -2^(width-1) and 2^(width-1)-1.BigInt.asIntN(width, bigint)

BigInt.asUintN(…)

Wraps a BigInt value to an unsigned integer between 0 and 2^width-1.BigInt.asUintN(width, bigint)

toLocaleString(…)

Returns a string with a language-sensitive representation of this BigInt.b.toLocaleString([locales, [options]])

toString(…)

Returns a string representing the specified BigInt object in the specified radix.b.toString([radix])

valueOf()

Returns the primitive value of the specified BigInt object.b.valueOf()

toString(…)

method

Returns a string representing the specified BigInt object in the specified radix. b.toString([radix])

Beginner Examples

(123456789n).toString()123456789

Convert to hexadecimal representation.(123456789n).toString(16)75bcd15

Convert to binary representation.(123456789n).toString(2)111010110111100110100010101

Convert to base 36 representation.(123456789n).toString(36)21i3v9

You seem to be offline. App may not work.