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()

valueOf()

method

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

Beginner Examples

Returns the primitive BigInt value.const bigint = Object(1n); bigint.valueOf()1n

Intermediate Examples

The Object(1n) creates a BigInt object.const bigint = Object(1n); typeof bigintobject

The valueOf method returns a primitive bigint.const bigint = Object(1n); typeof bigint.valueOf()bigint

You seem to be offline. App may not work.