# Math Object in JavaScript

The JavaScript Math object used to perform mathematical tasks with numbers.`Math` is an object that has properties and methods.

`Math` has no constructor. All `Math’s` properties and methods are static.

To refer methods and properties use Math.propertName  and functions as Math.funcationName().

For example to access the constant pi use `Math.PI`

` To` call the sine function use `Math.sin(valuex)`, where `valuex` is a argument. Constants are defined with the full precision of real numbers.

The math object provide properties and methods of constants and functions for mathematical.

Math’s properties and methods can be called by using Math as an object without creating it.

Syntax

Example

## Math Properties (Constants)

PropertyDescription
EIt will return Euler’s number (approx. 2.718).
LN2It will return tde natural logaritdm of 2 (approx. 0.693)
LN10It will return tde natural logaritdm of 10 (approx. 2.302)
LOG2EIt will return tde base-2 logaritdm of E (approx. 1.442)
LOG10EIt will return tde base 10 logaritdm of E (approx. 0.434)
PIIt will return constant value of PI (approx. 3.14)
SQRT1_2It will return tde square root of 1/2 (approx. 0.707)
SQRT2It will returnstde square root of 2 (approx. 1.414)

## Math Object Methods

MathodDescription
abs(valuex)It will return the absolute value of valuex
acos(valuex)It will return the arccosine of valuex, in radians
asin(valuex)It will return the arcsine of valuex, in radians
atan(valuex)It will return the arctangent of valuex as a numeric value between -PI/2 and PI/2 radians
atan2(valuey, valuex)It will return the arctangent of the quotient of its arguments
ceil(valuex)It will return the value of valuex rounded up to its nearest integer
cos(valuex)It will return the cosine of valuex (valuex is in radians)
exp(valuex)It will return the value of Ex
floor(valuex)It will return the value of valuex rounded down to its nearest integer
log(valuex)It will return the natural logarithm (base E) of valuex
max(valuex,value y, valuez, …, valuen)It will return the number with the highest value
min(valuex,valuey, valuez, …, valuen)It will return the number with the lowest value
pow(valuex, valuey)It will return the value of valuex to the power of valuey
random()It will return a random number between 0 and 1
round(valuex)It will return the value of valuex rounded to its nearest integer
sin(valuex)It will return the sine of valuex (valuex is in radians)
sqrt(valuex)It will return the square root of valuex
tan(valuex)It will return the tangent of an angle