JavaScript
Math
Methods
JavaScript Math methods with examples
01/39
Sajan Kota
JavaScript Math Methods
[Link]() Math.clz32()
[Link]() [Link]()
[Link]() [Link]()
[Link]() [Link]()
[Link]() Math.expm1()
[Link]() [Link]()
Math.atan2() [Link]()
[Link]() [Link]()
[Link]() [Link]()
[Link]() [Link]()
02/39
Sajan Kota
JavaScript Math Methods
Math.log10() [Link]()
Math.log1p() [Link]()
Math.log2() [Link]()
[Link]() [Link]()
[Link]() [Link]()
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
03/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the absolute
(positive) value of a number x.
04/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the arccosine (in
radians) of a number x.
05/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the inverse
hyperbolic cosine of a number x.
06/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the arcsine (in
radians) of a number x.
07/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the inverse
hyperbolic sine of a number x.
08/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the arctangent (in
radians) of the number x.
09/39
Sajan Kota
JavaScript Math Methods
Math.atan2()
The Math.atan2() returns the arctangent of
the quotient of its arguments y and x.
10/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the inverse
hyperbolic tangent of the number x.
11/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the cube root of
the number x.
12/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the arctangent (in
radians) of the number x.
13/39
Sajan Kota
JavaScript Math Methods
Math.clz32()
The Math.clz32() returns the number of
leading zero bits in the 32-bit binary
representation of the number x.
14/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the cosine of the
number x(measured in radians).
15/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the hyperbolic
cosine of the number x.
16/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() return’s e (Euler's number,
approximately 2.71828) raised to the
power of the number x.
71/39
Sajan Kota
JavaScript Math Methods
Math.expm1()
The Math.expm1() returns e^x - 1, where e
is Euler's number, and x is a number.
18/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the largest
integer less than or equal to a number x.
19/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the nearest 32-
bit single precision float representation of
the number x.
20/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the square root
of the sum of the squares of its arguments.
It calculates the Euclidean distance
(length) of a vector.
21/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the result of the
32-bit integer multiplication of two
numbers x and y.
22/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the natural
logarithm (base e) of a number x.
23/39
Sajan Kota
JavaScript Math Methods
Math.log10()
The Math.log10() returns the base 10
logarithm of a number x.
24/39
Sajan Kota
JavaScript Math Methods
Math.log1p()
The Math.log1p() returns the natural
logarithm of 1 plus the number x. Useful
for accurately calculating the logarithm of
numbers close to 1.
25/39
Sajan Kota
JavaScript Math Methods
Math.log2()
The Math.log2() returns the base 2
logarithm of a number x.
26/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the largest of the
given arguments or array elements.
27/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the smallest of the
given arguments or array elements.
28/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns x raised to the
power of y.
29/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns a random
floating-point number between 0
(inclusive) and 1 (exclusive).
30/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() rounds a number to the
nearest integer.
31/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the sign of a
number `x` (1 for positive numbers, -1 for
negative numbers, and 0 for zero).
32/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the sine of a number
x (measured in radians).
33/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the hyperbolic
sine of a number x.
34/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the square root of
a number x.
35/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the tangent of a
number x (measured in radians).
36/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the hyperbolic
tangent of the number x.
37/39
Sajan Kota
JavaScript Math Methods
[Link]()
The [Link]() returns the integer part
of a number `x` by removing the fractional
part (does not round).
38/39
Sajan Kota
JavaScript Math Methods
Which of these JavaScript
Math methods do you use
in your projects?
Let’s connect and expand our
professional network together
39/39
Sajan Kota