GoConqr has a new look! Let us know what you think.

Module 3 of 10 · Media

Math Functions

Kostas Diakogiannis

Math Functions

Math Functions

Some of the commonest functions used with the Math object are:

1. Math.random() => This returns a random number between 0 and 1. ex. 0.58346. It is heavily used for generating random ticket numbers, lottery, and other equivalent stuff.

2. Math.round(x) => rounds the decimal number X to the closest integer. ex. 0.5678 gets 1.

3. Math.ceil(x) =>  rounds the decimal X to the next integer. ex. 4.3 becomes 5

4. Math.floor(x) => rounds the decimal X to the previous integer. ex. 4.9 becomes 4.

5. Math.pow(x, y) => returns the result of X to the power of Y. ex Math.pow(10,3) = 1000

6. Math.sqrt(x) => returns the square root of number X.

7. math.abs(x) => returns the absolute value of the number X

8. Math.min(x, y, z) => returns the lowest number of a list of numbers. 

9. Math.max(x, y, z) => returns the biggest number of a list of numers

 

For full documentation list of functions see always here:

 

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?