JAVASCRIPT BASIC
JAVASCRIPT & DOM
JAVASCRIPT & BOM
JAVASCRIPT EXAMPLES
JAVASCRIPT REFERENCE

# JavaScript Math Reference

This chapter contains a brief overview of the properties and method of the global Math object.

## The JavaScript Math Object

The JavaScript Math object is used to perform mathematical tasks. The Math object is a static built-in object, so you won't need to instantiate it, all its properties and methods can be accessed directly.

## Math Properties

The following table lists the standard properties of the Math object.

Property Description
`E` Returns Euler's number, the base of natural logarithms, `e`, approximately 2.718
`LN2` Returns the natural logarithm of 2, approximately 0.693
`LN10` Returns the natural logarithm of 10, approximately 2.302
`LOG2E` Returns the base 2 logarithm of `e`, approximately 1.442
`LOG10E` Returns the base 10 logarithm of `e`, approximately 0.434
`PI` Returns the ratio of the circumference of a circle to its diameter (i.e. `π`). The approximate value of PI is 3.14159
`SQRT1_2` Returns the square root of 1/2, approximately 0.707
`SQRT2` Returns the square root of 2, approximately 1.414

Note: The Math object is just a collection of static functions and constants. The Math object is different from other built-in objects (e.g. Date, Array, String, etc.), because it has no constructor, so there is no way to create an instance of Math.

## Math Methods

The following table lists the standard methods of the Math object.

Method Description
`abs()` Returns the absolute value of a number.
`acos()` Returns the arccosine of a number, in radians.
`acosh()` Returns the hyperbolic arccosine of a number.
`asin()` Returns the arcsine of a number, in radians
`asinh()` Returns the hyperbolic arcsine of a number.
`atan()` Returns the arctangent of a number, in radians.
`atan2(y, x)` Returns the arctangent of the quotient of its arguments.
`atanh()` Returns the hyperbolic arctangent of a number.
`cbrt()` Returns the cube root of a number.
`ceil()` Returns the next integer greater than or equal to a given number (rounding up).
`cos()` Returns the cosine of the specified angle. The angle must be specified in radians.
`cosh()` Returns the hyperbolic cosine of a number.
`exp(x)` Returns `ex`, where `x` is the argument, and `e` is Euler's number (also known as Napier's constant), the base of the natural logarithms.
`floor()` Returns the next integer less than or equal to a given number (rounding down).
`log()` Returns the natural logarithm (base `e`) of a number.
`max(x, y, ...)` Returns the highest-valued number in a list of numbers.
`min(x, y, ...)` Returns the lowest-valued number in a list of numbers.
`pow(x, y)` Returns the base to the exponent power, that is, `xy`.
`random()` Returns a random number between 0 and 1 (including 0, but not 1).
`round()` Returns the value of a number rounded to the nearest integer.
`sin()` Returns the sign of a number (given in radians).
`sinh()` Returns the hyperbolic sine of a number.
`sqrt()` Returns the square root of a number.
`tan()` Returns the tangent of a number.
`tanh()` Returns the hyperbolic tangent of a number.
`trunc(x)` Returns the integer part of a number by removing any fractional digits.