JavaScript Math Object

In JavaScript, Math is a built-in object that allows you to perform mathematical operations on the Number type. Math is not a constructor function. It's a property of the implicit global object.

In this reference page, you will find all methods of Math object. You can access methods and constants of the Math object directly. For example, to use the mathematical PI constant, use Math.PI in your code.

JavaScript Math sin()

Returns the sine of an angle

JavaScript Math cos()

Returns the cosine of an angle

JavaScript Math tan()

Returns the tangent of an angle

JavaScript Math.abs()

Returns the absolute value of a number

JavaScript Math.pow()

Returns a number raised to a certain power

JavaScript Math asin()

Returns the arcsine of a number in radians

JavaScript Math acos()

Returns the arccosine of a number in radians

JavaScript Math atan()

Returns the arctangent of a number in radians

JavaScript Math ceil()

Rounds a number up to the next largest integer

JavaScript Math floor()

Rounds down a number to the next smallest integer

JavaScript Math round()

Returns the number rounded to the nearest integer

JavaScript Math trunc()

Returns the integer part of a number

JavaScript Math max()

Returns the number with the highest value

JavaScript Math min()

Returns the number with the lowest value

JavaScript Math.sqrt()

Returns the square root of a specified number

JavaScript Math sign()

Returns the sign of a number

JavaScript Math.log()

Returns the natural logarithm of a number

JavaScript Math.log2()

Returns the base 2 logarithm of a number

JavaScript Math.log10()

Returns the base 10 logarithm of a number

JavaScript Math.log1p()

Returns the natural logarithm of 1 plus number

JavaScript Math.exp()

Returns e (Euler's number) raised to given power

JavaScript Math.expm1()

Returns e raised to given power minus 1

JavaScript Math sinh()

Returns the hyperbolic sine of a number

JavaScript Math cosh()

Returns the hyperbolic cosine of a number

JavaScript Math tanh()

Returns the hyperbolic tangent of a number

JavaScript Math asinh()

Returns the hyperbolic arcsine of a number

JavaScript Math acosh()

Returns the hyperbolic arc-cosine of a number

JavaScript Math atanh()

Returns the hyperbolic arctangent of a number

JavaScript Math atan2()

Returns arctangent of the quotient of arguments

JavaScript Math.fround()

Returns the 32-bit float representation of number

JavaScript Math.hypot()

Returns sqrt of the sum of squares of arguments

JavaScript Math cbrt()

Returns the cube root of a specified number

JavaScript Math clz32()

Returns num of leading zeros in binary of a number

JavaScript Math random()

Returns pseudo-random float number between 0 and 1