JavaScript Math Object Tutorial

include a decimal value in your numbers for better calculation and then click one of the Math Object methods

Input a: Input b:

Gives a random number up to 5
Gives a random number up to 5 and rounded off


Math.ceil(a) - Returns the smallest integer greater than or equal to a

Math.floor(a) - Returns the greatest integer less than or equal to a

Math.round(a) - Returns the integer nearest to a

Math.sqrt(a) - Returns the square root of a

Math.random() - Returns a pseudo-random number in the range 0 to 0.999999999999

Math.min(a,b) - Returns the greater of a and b

Math.min(a,b) - Returns the lesser of a and b

Math.pow(a,b) - Returns a to the power of b