Home > DeveloperSection > Articles > JavaScript-Math Object

Ratings:
0 Comment(s)
3151  View(s)
Rate this:

# JavaScript-Math Object

## Introduction:

In this article I am going to explain you about Math object which provides us several mathematical functionalities. The Math object allows us to perform common mathematical tasks. It includes several Mathematical constants and methods. Unlike other global objects Math is not a constructor all methods and properties of Method are static and all properties and methods of math can be called by using Math as an object without creating it.

### Syntax for using Math Methods is:

var roundof = Math.round(0.6);

This function will round of the value of 0.6 to 1.

Math Methods:

 Methods Description abs () Returns the absolute value of a number. acos() It returns the arccosine of a number. asin() It returns the arcsine of a number. atan() It returns the arctangent of a number. ceil() It returns the smallest integer greater than or equal to a number. floor() It returns the largest integer less than or equal to a number. log() It returns the Natural logarithm of a number. max() It returns the largest number of zero or more number. min() It returns the smallest of zero or more number. round() It returns the value of a number rounded to the nearest integer. sin() It returns the sine of a number. sqrt() It returns the square root of a number. tan() It returns the tangent of a number. toSource() It returns the string “Math”. pow() It returns the base to the exponent power i.e. base exponent.

### Examples depicting the use of the above methods:

#### abs():

       Output:

#### acos():

     Output:

#### ceil():

     Java Script Ceil Method         Output:

#### floor:

     Java Script floor Method          Output :

#### round():

       Output:

#### max():

           Java Script to get the max value                                   Output:

#### min():

     Java Script to get the max value       Output:

### Conclusion:

Through this article we came to know about what math function is and how to use its various methods.