JS BigInt & Number Flashcards

1
Q

Is a BigInt strictly equal to a Number?

A

No,

but it is loosely equal

bigInt === number //false

bigInt == number //true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Can BigInt be compared to Number?

A

Yes, all < <= > >= can compare them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Can you perform arithmetic between BigInt and Number?

A

No, BigInt and Number are separate types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

BigInt.asIntN()

A

Clamps a BigInt value to a signed integer value, and returns that value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

BigInt.asUintN()

A

Clamps a BigInt value to an unsigned integer value, and returns that value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

BigInt.prototype.toString()

BigInt.prototype.toLocaleString()

A

Returns a string representing this BigInt value in the specified radix (base). Overrides the Object.prototype.toString() method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Because coercing between Number values and BigInt values can lead to loss of precision, what is recommended?

A

Only use a BigInt value when values greater than 2^53 are reasonably expected.
Don’t coerce between BigInt values and Number values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Number.EPSILON

A

The smallest interval between two representable numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Number.MAX_SAFE_INTEGER

Number.MAX_VALUE

A

The maximum safe integer in JavaScript (253 - 1).

The largest positive representable number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Number.MIN_SAFE_INTEGER

Number.MIN_VALUE

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Number.NaN

Number.NEGATIVE_INFINITY

Number.POSITIVE_INFINITY

A

Special “Not a Number” value.

values representing +/- infinity returned on overflow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Number.isNaN()

A

Determine whether the passed value is NaN.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Number.isFinite()

A

Determine whether the passed value is a finite number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Number.isSafeInteger()

Number.isInteger()

A

Determine whether the passed value is a safe integer (number between -(253 - 1) and 253 - 1).

Determine whether the passed value is an integer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Number.prototype.toExponential(fractionDigits)

A

Returns a string representing the number in exponential notation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Number.prototype.toFixed(digits)

A

Returns a string representing the number in fixed-point notation.

17
Q

Number.prototype.toPrecision(precision)

A

Returns a string representing the number to a specified precision in fixed-point or exponential notation.

18
Q

Number.prototype.toLocaleString([locales [, options]])

A

Returns a string with a language sensitive representation of this number. Overrides the Object.prototype.toLocaleString() method.

19
Q

Does Math work with BigInt?

A

No, the Math object does not work with BigInt

20
Q

Are unary operators supported for BigInt?

A

No, unary operators are not supported for BigInt

21
Q

What operators are supported for BigInt?

A

+ * - % **