JS BigInt & Number Flashcards
Is a BigInt strictly equal to a Number?
No,
but it is loosely equal
bigInt === number //false
bigInt == number //true
Can BigInt be compared to Number?
Yes, all < <= > >= can compare them
Can you perform arithmetic between BigInt and Number?
No, BigInt and Number are separate types
BigInt.asIntN()
Clamps a BigInt value to a signed integer value, and returns that value.
BigInt.asUintN()
Clamps a BigInt value to an unsigned integer value, and returns that value.
BigInt.prototype.toString()
BigInt.prototype.toLocaleString()
Returns a string representing this BigInt value in the specified radix (base). Overrides the Object.prototype.toString() method.
Because coercing between Number values and BigInt values can lead to loss of precision, what is recommended?
Only use a BigInt value when values greater than 2^53 are reasonably expected.
Don’t coerce between BigInt values and Number values.
Number.EPSILON
The smallest interval between two representable numbers.
Number.MAX_SAFE_INTEGER
Number.MAX_VALUE
The maximum safe integer in JavaScript (253 - 1).
The largest positive representable number.
Number.MIN_SAFE_INTEGER
Number.MIN_VALUE
The minimum safe integer in JavaScript (-(253 - 1)).
The smallest positive representable number—that is, the positive number closest to zero (without actually being zero).
Number.NaN
Number.NEGATIVE_INFINITY
Number.POSITIVE_INFINITY
Special “Not a Number” value.
values representing +/- infinity returned on overflow
Number.isNaN()
Determine whether the passed value is NaN.
Number.isFinite()
Determine whether the passed value is a finite number.
Number.isSafeInteger()
Number.isInteger()
Determine whether the passed value is a safe integer (number between -(253 - 1) and 253 - 1).
Determine whether the passed value is an integer.
Number.prototype.toExponential(fractionDigits)
Returns a string representing the number in exponential notation.