Table of contents
No headings in the article.
In JavaScript, Math is a built-in object that allows you to perform mathematical operations on the Number type. Math is not a constructor function. It is a property of the implicit global object.
Here are some, let's check them out.
1. round
round() is a function that is used to return a number rounded to the nearest integer value.
2. floor
floor() is a function that is used to return the largest integer value that is less than or equal to a number. In other words, the floor() function rounds a number down and returns an integer value.
3. random
The Math.random() function returns a floating-point, pseudo-random number in the range 0 to less than 1 (inclusive of 0, but not 1)
4. max
The Math.max() function returns the largest of the zero or more numbers given as input parameters, or NaN if any parameter isn't a number and can't be converted into one.
5. min
The static function Math.min() returns the lowest-valued number passed into it, or NaN if any parameter isn't a number and can't be converted into one.
6. ceil
ceil() is a function that is used to return the smallest integer value that is greater than or equal to a number. In other words, the ceil() function rounds a number up and returns an integer value.
7. pow
The Math.pow() function returns the base to the exponent power, as in base^exponent.
Hope this helps you to make your coding fun. It has helped me a lot. Thank you... Follow me on Twitter See ya✌️.
Connect with me on Linkedin
Ravi .M. Damor