# JS Math Object

## Math object

Math objects are used to perform mathematical tasks.

Math objects are not classes of objects like Date and String, so there is no constructor Math().

## Grammar

var x = Math.PI; // returns PI
var y = Math. sqrt(16); // returns the square root of 16

Math object tutorial, please refer to JavaScript Math object tutorial .

## Math object properties

PropertyDescriptiom
EReturns the arithmetic constant e, the base of the natural logarithm (approximately equal to 2.718).
LN2Returns the natural logarithm of 2 (approximately equal to 0.693).
LN10Returns the natural logarithm of 10 (approximately equal to 2.302).
LOG2EReturns the base 2 logarithm of e (approximately 1.4426950408889634).
LOG10EReturns the base 10 logarithm of e (approximately equal to 0.434).
PIReturns pi (approximately equal to 3.14159).
SQRT1_2Returns the inverse of the square root of 2 (approximately equal to 0.707).
SQRT2Returns the square root of 2 (approximately equal to 1.414).

## Math object methods

MethodDescription
abs(x)Returns the absolute value of x.
acos(x)Returns the inverse cosine value of x.
asin(x)Returns the arcsine value of x.
atan(x)Returns the arctangent of x as a numeric 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).
ceil(x)Rounds up the logarithm.
cos(x)Returns the cosine of the number.
exp(x)Returns the exponent of Ex .
floor(x)Rounds x down.
log(x)Returns the natural logarithm of the number (base e).
max(x,y,z,...,n)Returns the highest value in x,y,z,...,n.
min(x,y,z,...,n)Returns the lowest value in x,y,z,...,n.
pow(x,y)Returns the power of x to the yth.
random()Returns a random number between 0 and 1.
round(x)Rounded.
sin(x)Returns the sine of the number.
sqrt(x)Returns the square root of the number.
tan(x)Returns the tangent of the angle.