9 Common JavaScript Math Functions

Rhea RB
2 min readNov 28, 2022

--

The Math Object in JavaScript Allows us to perform Mathematical Tasks on numbers.

Let’s Understand some helpful Methods of Math Object in JavaScript.

Math.trunc()
It returns only the integer part of the given number by simply removing the fractional units.

Math.floor()
Math.floor(x) returns the values of x rounded down to its nearest integer. Where x will be a number.

Math.ceil()
Math.ceil(x) returns the values of x rounded up to its nearest integer. Where x will be a number.

Math.abs()
This method returns the absolute i.e the positive value of the given number.

Math.random()
This method returns a random number between 0 and 1(exclusive)

Math.pow()
This method takes in two parameters i.e Math.pow(x,y) and it returns the value of x to the power of y

Math.sqrt()
This method simply returns the square root of the given number.

Math.min()
It returns the lowest value from a list of numbers passed as parameters.

Math.max()
It returns the highest value from a list of numbers passed as parameters.

If you liked my blog please do follow me on : Rhea RB.

Thank you for Reading !. Happy Coding !!!

--

--

Rhea RB
Rhea RB

Written by Rhea RB

Hello ! I am a senior software engineer, passionate about tech and product.

No responses yet