Skip to content
Related Articles

Related Articles

JavaScript Math Object Complete Reference

Improve Article
Save Article
  • Last Updated : 23 Nov, 2022
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:

Properties:

JavaScript Math object Properties

Description

JavaScript Math.E() function The number e is a mathematical constant having an approximate value equal to 2.718.
JavaScript Math.LN2 property The Math.LN2 is a property in JavaScript which is simply used to find the value of a natural log of 2.
JavaScript Math.LN10 property The Math.LN10 is a property in JavaScript which is simply used to find the value of a natural log of 10.
JavaScript Math.LOG2E property The Math.LOG2E is a property in JavaScript which is simply used to find the value of base 2 logarithms of e, where e is an irrational and transcendental number approximately equal to 2.718 
JavaScript Math.LOG10E property The Math.LOG10E is a property in JavaScript which is simply used to find the value of base 10 logarithms of e, where e is an irrational and transcendental number approximately equal to 2.718 
JavaScript Math.PI Property The Math.PI is a property in JavaScript which is simply used to find the value of Pi
JavaScript Math.SQRT1_2 property The Math.SQRT1_2 is a property in JavaScript which is simply used to find the value of the square root of 1/2, whose value is approximately 0.707106. 
JavaScript Math.SQRT2 property The Math.SQRT2 is a property in JavaScript which is simply used to find the value of the square root of 2, whose value is approximately 1.4142
 

Methods:

JavaScript Math object Methods Description
Javascript Math.abs() The Math.abs() method is used to return the absolute value of a number. It takes a number as its parameter and returns its absolute value.
Javascript Math.acos() The Math.acos( ) method is used to return the arccosine of a number in radians.
Javascript Math.acosh() The Math.acosh() function in Javascript is used to return the hyperbolic arc-cosine of a number. 
Javascript Math.asin() The Math.asin( ) method is used to return the arcsine of a number in radians
Javascript Math.asinh() The Math.atan( ) method is used to return the arctangent of a number in radians.
Javascript Math.atan() The Math.atan( ) method is used to return the arctangent of a number in radians. 
Javascript Math.atan2() The Math.atan2() method is used to return the arctangent of the quotient of its arguments.
Javascript Math.atanh() The Math.atanh() method is used to return the hyperbolic arctangent of a number.
Javascript Math.cbrt() The Math.cbrt() method is used to find cube root of a number.
Javascript Math.ceil() The Math.ceil() function in JavaScript is used to round the number passed as a parameter to its nearest integer in an Upward direction of rounding i.e towards the greater value.
Javascript Math.clz32() JavaScript Math.clz32() is an inbuilt function in JavaScript that stands for “Count Leading Zeroes 32”.
Javascript Math.cos() The Math.cos() method is used to return the cosine of a number. 
Javascript Math.cosh() Math.cosh() method is used to calculate the value of the hyperbolic cosine of a number.
Javascript Math.exp() The Math.exp() method is used to return ex, where x is the argument, and e is Euler’s number, which is the base of the natural logarithms.
Javascript Math.expm1() Math.expm1() is an inbuilt function in JavaScript that is used to get the value of ep-1, where p is any given number.
Javascript Math.floor() The Math.floor method is used to round off the number passed as a parameter to its nearest integer in a Downward direction of rounding i.e. towards the lesser value.
Javascript Math.fround() The Math.fround() function in JavaScript is used to find the nearest 32-bit single-precision float representation of a given Number.
Javascript Math.hypot() The Math.hypot() function in JavaScript is used to calculate the square root of the sum of squares of numbers passed to it as arguments.
Javascript Math.imul() The Math.imul() function in JavaScript is used to calculate the result of the 32-bit multiplication of the two integers passed as parameters to it
Javascript Math.log() The Math.log() method is used to return the natural logarithm (base e) of a number.
JavaScript Math.log1p() The Math.log1p() is an inbuilt function in JavaScript that gives the value of the natural logarithm of 1 + p number. 
Javascript Math.log2() The Math.log2() is an inbuilt function in JavaScript that gives the value of base 2 logarithms of any number. 
Javascript Math.log10() The Math.log10() is an inbuilt function in JavaScript that gives the value of base 10 logarithms of any number.
Javascript Math.max() The Math.max() method is used to return the largest of zero or more numbers. 
Javascript Math.min() The Math.min() method is used to return the lowest-valued number passed in the method
Javascript Math.pow() The Math.pow() method is used to power a number i.e., the value of the number raised to some exponent
Javascript Math.random() The Math.random() function is used to return a floating-point pseudo-random number between range [0,1), 0 (inclusive), and 1 (exclusive)
JavaScript Math.round( ) The Math.round() function in JavaScript is used to round the number passed as a parameter to its nearest integer.
Javascript Math.sign( ) The Math.sign() is a built-in function in JavaScript and is used to know the sign of a number, indicating whether the number specified is negative or positive.
Javascript Math.sin() The Math.sin() method in Javascript is used to return the sine of a number.
Javascript Math.sinh() The Math.sqrt() method in JavaScript is used to square the root of the number passed as a parameter to the function.
JavaScript Math.sqrt( ) The Math.sqrt() method in JavaScript is used to square the root of the number passed as a parameter to the function. 
Javascript Math.tan() The Math.tan() method in Javascript is used to return the tangent of a number.
Javascript Math.tanh() The Math.tanh() method is used to calculate the value of the hyperbolic tangent of a number. 
Javascript Math.trunc() The Math.trunc() method is used to 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!