Most useful javascript math functions
Pratik Lochawala
Posted on May 30, 2021
abs
Math.abs function returns the absolute value of a number
ceil
Math.ceil function rounds a number up to the next largest integer
floor
Math.floor function rounds a number down to its nearest integer
round
Math.round function rounds a number to its nearest integer
trunc
Math.trunc function returns the integer part of a number
max
Math.max function returns the number with the largest value
min
Math.min function returns the number with the lowest value
pow
Math.pow function returns the base to the exponent power
sqrt
Math.sqrt function returns the square root of a number
cbrt
Math.cbrt function returns the cubic root of a number
random
Math.random return random number between 0 to 1
Bonus
sign
Math.sign return an argument is negative, positive or NaN
Wrapping up!
Share this blog with your friends ๐ฉ๐ผโ๐คโ๐ง๐ผ and developers ๐จโ๐ป you know and let them know these
Your feedback and comments are very important to me. ๐
Get in touch ๐ค๐ค
Posted on May 30, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 28, 2024