Round, Random, Min and Max are the methods used in math object in JavaSript. Math object allows you to perform common mathematical tasks. The math object includes several mathematical values and functions. Yo do not need to define the math object before using it. In this post I am describing How to use Round, Random, Min and Max in JavaSript.
Using round() method in math object, you can round the given numbers as given below.
You can use the random() method in math object,you can return a random number between 0 and 1 as given below.
Using max() method in math object, you can return the number with the highest value of two specified numbers as the following.
Using min() method in math object, you can return the number with the highest value of two specified numbers as the following.
There are also other more methods on JavaScript math object to perform common mathematical tasks which are listed below along with their description. You can use them as the methods given above.
Related Posts:
How to use Round() in JavaScript
Using round() method in math object, you can round the given numbers as given below.
Preview:
How to use Random() in JavaScript
You can use the random() method in math object,you can return a random number between 0 and 1 as given below.
Preview:
How to use Max() in JavaScript
Using max() method in math object, you can return the number with the highest value of two specified numbers as the following.
Preview:
How to use Min() in JavaScript
Using min() method in math object, you can return the number with the highest value of two specified numbers as the following.
Preview:
There are also other more methods on JavaScript math object to perform common mathematical tasks which are listed below along with their description. You can use them as the methods given above.
- abs(x): Returns the absolute value of a number
- ceil(x): Returns the value of a number rounded upwards to the nearest integer
- exp(x): Returns the value or E^x.
- floor(x): Returns the value of a number rounded downwards to the nearest integer.
- log(x): Returns the natural logarithm (base E) of a number.
- pow(x,y): Returns the value of x to the power of y.
- sqrt(x): Returns the square root of a number.
Related Search Terms
Calculate Round in JavaScript
Generate Random number in JavaScript
Finding Min and Max in Javascript
Related Posts:
How to Show Pop Up Boxes Using JavaScript?
How to Write Conditional Statements in JavaScript?
How to Write JavaScript With HTML?
How to Loop using JavaScript?
Image Slideshow with Navigation Buttons Using JavaScript
How to create Changeable Date and Time Using JavaScript?
How to Create JavaScript Image Slideshow with LInks
How to Display Date Format in JavaScript?
How to Validate a HTML Form Using JavaScript?
What are the Different Ways to Redirect Page in JavaScript?
How to Detect Visitor's Browser Using JavaScript?
How to make rounded corners border using CSS
How to Create Custom CSS Template for Printing
How to create a simple form using HTML?