Skip to content
Related Articles
Open in App
Not now

Related Articles

JavaScript Math Object Complete Reference

Improve Article
Save Article
  • Last Updated : 11 Jan, 2023
Improve Article
Save Article

The Math object is used to perform mathematical operations on numbers. The below example will give you a brief idea of JavaScript math objects.

Example:

javascript




<script>
    // Return PI value(3.141592653589793)
    console.log(Math.PI);
</script>

Output: 

3.141592653589793 

There are many Math object properties and methods in JavaScript which are listed below:

JavaScript Math object Properties :

Properties

Description

LN2Find the value of a natural log of 2.
LN10Find the value of a natural log of 10.
LOG2EFind the value of base 2 logarithms of e, where e is approximately equal to1.442
LOG10EFind the value of base 10 logarithms of e, where e is approximately equal to 0.434.
PIFind the value of Pi
SQRT1_2Find the value of the square root of 1/2, whose value is approximately 0.707106. 
SQRT2Find the value of the square root of 2, whose value is approximately 1.4142
 

JavaScript Math object Methods:

 Methods

Description

E() The exp is a mathematical constant having an approximate value equal to 2.718.
abs()Return the absolute value of a number.
acos()Return the arccosine of a number in radians.
acosh()Return the hyperbolic arc-cosine of a number. 
asin()Return the arcsine of a number in radians
asinh()Return the arctangent of a number in radians.
atan()Return the arctangent of a number in radians. 
atan2()Return the arctangent of the quotient of its arguments.
atanh()Return the hyperbolic arctangent of a number.
cbrt()Find the cube root of a number.
ceil()The number is passed as a parameter to its nearest integer in an Upward direction of Rounding.
clz32()Stands for “Count Leading Zeroes 32”.
cos()Return the cosine of a number. 
cosh()Calculate the value of the hyperbolic cosine of a number.
exp()Return ex, where x is the argument, and e is Euler’s number.
expm1()Get the value of ep-1, where p is any given number.
floor()The number is passed as a parameter to its nearest integer in a Downward direction of rounding.
fround()Find the nearest 32-bit single-precision float representation of a given Number.
hypot()Calculate the square root of the sum of squares of numbers passed to it as arguments.
imul()Calculate the result of the 32-bit multiplication of the two integers passed as parameters to it
log()Return the natural logarithm (base e) of a number.
log1p()That gives the value of the natural logarithm of 1 + p number. 
log2()That gives the value of base 2 logarithms of any number. 
log10()That gives the value of base 10 logarithms of any number.
max()Return the largest of zero or more numbers. 
min()Return the lowest-valued number passed in the method
pow()The value of the number raised to some exponent
random()Return a floating-point pseudo-random number between range [0,1), 0 (inclusive), and 1 (exclusive)
round( )The number is passed as a parameter to its nearest integer.
sign( )Sign of a number, indicating whether the number specified is negative or positive.
sin()Return the sine of a number.
sinh()The root of the number is passed as a parameter to the function.
sqrt( )The root of the number is passed as a parameter to the function. 
tan()Return the tangent of a number.
tanh()Calculate the value of the hyperbolic tangent of a number. 
trunc()Return the integer part of a floating-point number by removing the fractional digits.

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!