# JavaScript USES an overview of the Math object methods

• 2020-03-30 01:10:22
• OfStack

1. Discard the decimals and keep the integers
ParseInt (5/2)

2. Round up, add 1 to the whole number if there are decimals

Math. Ceil (5/2)

3. Round.

Math. Round (5/2)

4, round down

Math. Floor (5/2)

Methods of the Math object
FF: Firefox, N: Netscape, IE: Internet Explorer

Method describes FF N IE
Abs of x returns the absolute value of 1, 2, 3
Acos of x returns the arccosine of the number 1, 2, 3
Asin of x returns the inverse sine of the number 1, 2, 3
Atan of x returns the inverse tangent of x with a value between -pi /2 and PI/2 radians
Atan2 (y,x) returns the Angle from the X-axis to the point (x,y) (between -pi /2 and PI/2 radians) 1, 2, 3
Ceil of x rounds up a number. 1 2 3
Cosine of x returns the cosine of 1, 2, 3
Exp of x returns e to the exponent. 1 2 3
Floor of x rounds off a number. 1 2 3
Log of x returns the natural log of the number (base e) 1, 2, 3
Max (x,y) returns the highest value of x and y, 1, 2, 3
Min of x,y returns the lowest values in x and y, 1, 2, 3
Pow of x,y returns x to the y power 1, 2, 3
Random () returns a random number between 0 and 1, 1, 2, 3
Round (x) rounds a number to the nearest integer 1, 2, 3
Sine of x returns the sine of the number 1, 2, 3
SQRT of x returns the square root of 1, 2, 3
Tangent of x returns the tangent of an Angle 1, 2, 3
ToSource () represents the object's source code 1, 4 -
ValueOf () returns the original valueOf a Math object

Related articles: