Math Obj properties and methods Flashcards

1
Q

What properties does the math object have?

A

Math.PI() returns Ratio of the circumference of a circle to its diameter, approximately 3.14159.

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

What method returns the absolute value of a number?

A

Math.abs(n)

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

What method returns the cube root of a number?

A

Math.cbrt(n)

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

What method rounds numbers down to the nearest integer? or what about up to the nearest?

A

Math.floor(n) Math.ceil(n)

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

What method returns the max number out of a group? syntax?

A

Math.max() will take numbers separated by commas or an array passed as a variable with spread operator

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

What method returns the min number out of a group? syntax?

A

Math.max() will take numbers separated by commas or an array passed as a variable with spread operator

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

What method returns a number to the n root? how does this differ from the other root function?

A

Math.sqrt(x) Returns the positive square root of a number.

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

Returns the integer part of the number x, removing any fractional digits.

A

Math.trunc(x)

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

Method Returns a pseudo-random number between 0 and 1. How do we get it to a certain number range?

A

Math.random()

function getRandomArbitrary(min, max) {
    return Math.random() * (max - min) + min;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly