Skip to main content

Command Palette

Search for a command to run...

JavaScript Math functions for beginners.

Updated
•2 min read•View as Markdown
JavaScript Math functions for beginners.
R

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.

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.

FJSqYq8WUAIVDV5.png

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.

FJSsLquXMAE6Gl5.png

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)

FJStQKVWYAE2FQ9.png

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.

FJSuSZJWQAAZW1q.jpeg

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.

FJSu2HsWYAArAd4.jpeg

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.

FJSvy5JWQAUT4fH.png

7. pow

The Math.pow() function returns the base to the exponent power, as in base^exponent.

FJSwkp5XIAEoMSk.png

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

A

Really helpful, saved it ✨

R

Thanks brother.

S

Awesome!! So knowledgeable

1
R

Thank you