Limitations and Considerations
- Some operators don’t support mixed types (both operands must be
BigInt
or neither). - Be cautious when coercing between
BigInt
and regular numbers (precision may be lost). - Unsigned right shift (
>>>
) is not supported forBigInt
.
Supported Browsers
The browsers supporting BigInt method are listed below:
JavaScript BigInt
BigInt is a built-in object in JavaScript that provides a way to represent whole numbers larger than 2^53 – 1. The largest number that JavaScript can reliably represent with the Number primitive is 2^53 – 1, which is represented by the MAX_SAFE_INTEGER constant. BigInts are utilized in scenarios where operations on large numbers are necessary due to their ability to represent integers with arbitrary precision.
Syntax:
BigInt( number )
or
Appending n to end of an integer literal
- Parameters: It accepts a single integer literal as a string that needs to be represented as BigInt.
- Return Type: This method returns the given value as BigInt data type.