Skip to main content

Command Palette

Search for a command to run...

Most useful javascript math functions

Published
β€’1 min read
Most useful javascript math functions
P

Software engineer | Web developer | Tech Enthusiast

abs

Math.abs function returns the absolute value of a number

carbon (22).png

ceil

Math.ceil function rounds a number up to the next largest integer

carbon (23).png

floor

Math.floor function rounds a number down to its nearest integer

carbon (25).png

round

Math.round function rounds a number to its nearest integer

carbon (24).png

trunc

Math.trunc function returns the integer part of a number

carbon (26).png

max

Math.max function returns the number with the largest value

carbon (55).png

min

Math.min function returns the number with the lowest value

carbon (54).png

pow

Math.pow function returns the base to the exponent power

carbon (31).png

sqrt

Math.sqrt function returns the square root of a number

carbon (32).png

cbrt

Math.cbrt function returns the cubic root of a number

carbon (33).png

random

Math.random return random number between 0 to 1

carbon (35).png

Bonus

sign

Math.sign return an argument is negative, positive or NaN

carbon (34).png

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 πŸ€œπŸ€›

Instagram

More from this blog

we web developers

7 posts

I'm Pratik, a tech enthusiast and a coder πŸ‘¨β€πŸ’» who is starting his journey in the field of web and software development after learning quite a bit