In this article, you’ll learn about 19 JavaScript Math methods that you should master today.

1. Math.abs()

The abs() method returns the absolute value of a number.

Output:

2. Math.cbrt()

The cbrt() method returns the cube root of a number.

Output:

3. Math.ceil()

The ceil() method returns the next integer greater than or equal to a given number.

Output:

4. Math.cos()

The cos() method returns the cosine of the specified angle The given angle must be specified in radians.

Output:

5. Math.cosh()

The cosh() method returns the hyperbolic cosine of a number.

Output:

6. Math.exp(x)

The exp(x) method returns e^x, where x is the argument, and e is Euler’s number (also known as Napier’s constant), the base of the natural logarithms.

Output:

7. Math.floor()

The floor() method returns the next integer less than or equal to a given number.

Output:

8. Math.log()

The log() method returns the natural logarithm (base e) of a number.

Output:

9. Math.max(x, y, …)

The max() method returns the highest-valued number from a list of numbers.

Output:

10. Math.min(x, y, …)

The min() method returns the lowest-valued number from a list of numbers.

Output:

11. Math.pow(x, y)

The pow(x, y) method returns the base to the exponent power (x^y).

Output:

12. Math.random()

The random() method returns a random number between 0 and 1 (inclusive of 0, but not 1).

Output:

13. Math.round()

The round() method returns the value of a number rounded to the nearest integer.

Output:

14. Math.sin()

The sin() method returns the sine of the specified angle The given angle must be specified in radians.

Output:

15. Math.sinh()

The sinh() method returns the hyperbolic sine of a number.

Output:

16. Math.sqrt()

The sqrt() method returns the square root of a number.

Output:

17. Math.tan()

The tan() method returns the tangent of a number.

Output:

18. Math.tanh()

The tanh() method returns the hyperbolic tangent of a number.

Output:

19. Math.trunc(x)

The trunc(x) method returns the integer portion of x, removing any fractional digits.

Output:

If you want to have a look at the complete source code used in this article, here’s the GitHub repository.

Make Use of Array Methods

Arrays are one of the most used data structures in programming. Along with Math methods, JavaScript also provides several built-in array methods like push(), concat(), join(), forEach(), map(), sort(), and so on. You can make use of all these built-in methods to work comfortably with JavaScript arrays.