JavaScript Math Functions

The JavaScript Math Objects provide various Functions and Constants / Properties, which allow us to perform mathematical functions.

Unlike other global objects, the properties and Functions available inside the math object are static. So, we can access the properties as PI and JavaScript math functions as abs(number).

JavaScript Math Object Properties

The following table will show you the list of Properties or Constants available in JavaScript Math Object.

PropertiesDescription
Math.eIt will return the Euler’s Number e, approximately equal to 2.71828
Math.ln2It will return a Natural Logarithm of 2, approximately equal to 0.693
Math.ln10This Function returns the Natural Logarithm of 10, approximately equal to 2.302
Math.log2eThe logarithm of E base 2, approximately equal to 1.443
Math.log10eThe logarithm of E base 10, approximately equal to 0.434
Math.piThis JavaScript Math function returns the Pie Value, approximately equal to 3.14
Math.sqrt1_2Square Root of 1/2 or 0.5, approximately equal to 0.707
Math.sqrt2Square Root of 2, approximately equal to 1.414

JavaScript Math Object Methods

The following table will show you the list of JavaScript Functions available in Math Object. To use the below functions, we have to use the object as a prefix. For example, Math.abs(x)

FunctionsDescription
abs(x)It returns the Absolute value of a given number
acos(x)It will return the ArcCosine value of a given number
acosh(x)Used to return the Hyperbolic Arc Cosine (inverse Hyperbolic Cosine) value of a supplied number
asin(x)It will return the Arc Sine value of a number
asinh(x)It will return the Hyperbolic Arc Sine (inverse Hyperbolic Sine) value of a supplied number
atan(x)This returns the Arc Tangent value of a given number
atan2(y, x)It will return the angle (in radius) from the X-Axis to the specified point (y, x).
cbrt(x)Used to find the Cube Root of a supplied number
atanh(x)Returns the Hyperbolic Arc Tangent (inverse Hyperbolic Tangent) value of a number
ceil(x)It is used to return the smallest integer value, which is greater than or equal to the specified expression or a number.
cos(x)Cosine value
cosh(x)Hyperbolic Cosine
exp(x)It is used to calculate the power of E, Where E is Euler’s number approximately equal to 2.71828.
floor(x)This JavaScript Math Function returns the largest integer value, which is less than or equal to the specified expression or a number.
hypot(value1, value2,…..valueN)It will extract the characters from a string based on the specified indices
log(x)It calculates the logarithmic value of a specified number with base E.
max(1, 2, 3, …..n)It is used to return the Maximum or Largest value from the specified set of expression
min(1, 2, 3, …..n)This JavaScript Math Function returns the Minimum or Smaller value from the specified set of expression
pow(x, y)It is used to calculate the Power of the specified expression
random()This function will print the random number between 0 and 1
round(x)It is used to round the specified expression or an individual number to the nearest integer.
sign(x)This function returns the sign of a given number. For instance, Positive, Negative, or Zero
sin(x)The sine value of x
sinh(x)Hyperbolic Sine value.
sqrt(x)It is used to find the square root of a specified expression or an individual number
tan(x)Return the Tangent value.
tanh(x)This Function prints the Hyperbolic Tangent.
trunc(x)It removes the decimal values from specified expressions and returns the integer value.