Loading Please Wait...
JavaScript BigInt variables are used to store big integer values that are too big to be represented by a normal JavaScript Number.
JavaScript integers are only accurate up to 15 digits.
let a = 999999999999999;
let b = 9999999999999999;
In JavaScript, all numbers are stored in a 64-bit floating-point format (IEEE 754 standard).
With this standard, large integer cannot be exactly represented and will be rounded.
Because of this, JavaScript can only safely represent integers
Up to 9007199254740991 +(253-1)
Down to -9007199254740991 -(253-1).
Integer values outside this range lose precision.
To create a BigInt, append n to the end of an integer or call BigInt():
let a = 1234567890123456789012345n;
let b = BigInt(1234567890123456789012345)
typeof a // returns bigint
Operators that can be used on a JavaScript Number can also be used on a BigInt.
let a = 9007199254740995n;
let b = 9007199254740995n;
let c = a + b;
let d = a - b;
let e = a * b;
BigInt can also be written in hexadecimal, octal, or binary notation:
let hex = 0x20000000000003n;
let oct = 0o400000000000000003n
let bin = 0b100000000000000000000000000000000000000000000000000011n;
How you feel about this blog:
Share this blog on:
If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com
Contact UsWe are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..
Copyright ©
, Lynxsia IT Solutions, All rights reserved