JavaScript Math functions for beginners. by Ravi DamorJavaScript Math functions for beginners. by Ravi Damor

JavaScript Math functions for beginners.

Ravi Damor

Ravi Damor

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
Undergraduate in Computer Science.Ambitious and energetic person who has developed a mature and responsible approach to any task that I undertake or situation that I am presented with. I have excellent communication skills and can liaise with all manner of people. I have all-around General Knowledge and skills in administration and programming. Open Source enthusiast who has a basic good knowledge of Python, C++, and Java. Also a UI/UX Google Certified Designer. Curious to learn new things and skills which might be accompanied by some mistakes I have good time management skills and can work well under pressure to tight deadlines.

Loading this content connects you to ravithemore.hashnode.dev.

ravithemore.hashnode.dev privacy information
Like this project

Posted May 17, 2023

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 pro…

Likes

0

Views

44