The Math object is a built-in object containing properties and methods used for mathematical computation.
It is a predefined JavaScript object and can be accessed without the use of a constructor or calling method.
All Math properties and methods are static.
Properties and Methods of the Math Object
Property/MethodDescription
abs()Returns absolute value of a number
acos()Returns the arccosine of a number
asin()Returns the arcsine of a number
atan()Returns the arctangent of a number
atan2()Returns the arctangent of the quotient of its parameters
ceilReturns the smallest integer greater than or equal to a number
cos()Returns the cosine of a number
EReturns the value for Euler's constant
exp()Returns Ex, where x is a number
floor()Returns the largest integer less than or equal to a number
LN10Returns the natural logarithm of 10
LN2Returns the natural logarithm of 2
log()Returns the natural logarithm (base E) of a number
LOG10EReturns the base 10 logarithm of E
LOG2EReturns the base 2 logarithm of E
max()Returns the larger of two arguments
min()Returns the smaller of two arguments
PIReturns the value of PI
pow()Returns base to the exponent power, baseexp
random()Returns a random number between 0 and 1
round()Rounds a number to its nearest integer
sin()Returns the sine of a number
sqrt()Returns the square root of a number
SQRT1_2Returns the square root of ?
SQRT2Returns the square root of 2
tan()Returns the tangent of a number
toSource()Creates a copy of an object
toString()Returns a string representation of an object
Example of creating a Math object