BigInt
Overview
The javascript BigInt implementation. BigInt is a built-in object that provides a way to represent whole numbers larger than 2^53-1. For more information see: BigInt (MDN).
Methods Summarized
Converts the BigInt value to a locale-sensitive string representation with the specified locales and formatting options.
Methods Detailed
asIntN(bits)
Returns a BigInt limited to a signed integer value of n bits.
Parameters
Number bits The number of bits to retain.
Returns: BigInt A new BigInt limited to n signed bits.
Sample
asUintN(bits)
Returns a BigInt limited to an unsigned integer value of n bits.
Parameters
Number bits The number of bits to retain.
Returns: BigInt A new BigInt limited to n unsigned bits.
Sample
toLocaleString()
Converts the BigInt value to a locale-sensitive string representation.
Returns: String The locale-sensitive string representation of the BigInt using the default locale.
Sample
toLocaleString(locales)
Converts the BigInt value to a locale-sensitive string representation.
Parameters
String locales A string with a BCP 47 language tag, or an array of such strings. Corresponds to the locales parameter of the Intl.NumberFormat() constructor.
Returns: String The locale-sensitive string representation of the BigInt.
Sample
toLocaleString(locales, options)
Converts the BigInt value to a locale-sensitive string representation with the specified locales and formatting options.
Parameters
String locales A string with a BCP 47 language tag, or an array of such strings.
Object options An object with formatting options, such as `useGrouping` and `minimumIntegerDigits`.
Returns: String The locale-sensitive string representation of the BigInt using the specified locale(s) and options.
Sample
toString()
Converts the BigInt value to a string using the default base (10).
Returns: String The string representation of the BigInt in base 10.
Sample
toString(radix)
Converts the BigInt value to a string in a specified base.
Parameters
Number radix An integer between 2 and 36 that specifies the base of the returned string.
Returns: String The string representation of the BigInt in the specified base.
Sample
valueOf()
Returns the primitive value of the BigInt object.
Returns: BigInt The primitive BigInt value.
Sample
Last updated
Was this helpful?