JavaScript Number methods Flashcards

1
Q

Math.max(5,18,22,19,166, “200”)

A

returns the maximum number even if there is a string

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

Math.min(4,5,6,7,87,43)

A

returns the minimum amount in the list

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

Math.random()

A

generates a random number from 0.01 - 0.99

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

Math.trunc(number)

A

removes the decimals or fractions

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

Math.floor(number)

A

rounds to the lowest amount

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

Math.ceil(number)

A

rounds up to the highest amount

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

(number).toFixed(number)

A

rounds the decimals. Returns a string. Example: +(2.7).toFixed(2)

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

parseFloat and parseInt

A

Both extract numbers from strings. parse float returns number with decimals while parseInt returns integers

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

Math.pow(x, y)

A

returns the value of x to the power of y

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