# Javascript Math Object

In Javascript Math object provides veriety of methods or function and properies that can be used to easily do mathematical calculations. Math object is an in built object and so it is not required to instantiate the object as done for Date object.

Unlike the other global objects, Math is not a constructor. All properties and methods of Math are static.

Syntax

Here is the simple syntax to call properties and methods of Math.

```<html>
<title>Javascript Math Object</title>
var log_val = Math.LOG10E;
var sine_val = Math.sin(10);
<body>
</body>
</html>
```

### Math Properties

Here is a list of each math property with description.

PropertyDescription
E Euler's constant and the base of natural logarithms, approximately 2.718.
LN2 Natural logarithm of 2, approximately 0.693.
LN10 Natural logarithm of 10, approximately 2.302.
LOG2E Base 2 logarithm of E, approximately 1.442.
LOG10E Base 10 logarithm of E, approximately 0.434.
PI Ratio of the circumference of a circle to its diameter, approximately 3.14159.
SQRT1_2 Square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707.
SQRT2 Square root of 2, approximately 1.414.

### Math Methods

Here is a list of each method of math object with description.

MethodDescription
abs()This will returns the absolute value of a number.
acos() This will returns the arccosine (in radians) of a number.
asin() This will returns the arcsine (in radians) of a number.
atan() This will returns the arctangent (in radians) of a number.
atan2() This will returns the arctangent of the quotient of its arguments.
ceil()This will returns the smallest integer greater than or equal to a number.
cos() This will returns the cosine of a number.
exp() This will returns EN, where N is the argument, and E is Euler's constant, the base of the natural logarithm.
floor()This will returns the largest integer less than or equal to a number.
log() This will returns the natural logarithm (base E) of a number.
max()This will returns the largest of zero or more numbers.
min() This will returns the smallest of zero or more numbers.
pow() This will returns base to the exponent power, that is, base exponent.
random()This will returns a pseudo-random number between 0 and 1.
round() This will returns the value of a number rounded to the nearest integer.
sin()This will returns the sine of a number.
sqrt()This will returns the square root of a number.
tan()This will returns the tangent of a number.

Math Example

```<DOCTYPE html>
<html>
<TITLE>Example of Number Object</TITLE>
<SCRIPT LANGUAGE="JavaScript">
document.write(Math.round(7.25));
document.write("</br>");
document.write(Math.random());
document.write("</br>");
var no=Math.random()*10
document.write(Math.floor(no))
document.write("</br>");
document.write(Math.max(2,4))
document.write("</br>");
document.write(Math.min(2,4))
document.write("</br>");
document.write(Math.ceil(4.4));
document.write("</br>");
</SCRIPT>
<BODY>
</BODY>
</HTML>
```
Try Now

 Javascript Built in String Object Javascript Built in Number Object Javascript Built in Math Object Javascript Built in Date Object Javascript Built in Arrays Object Javascript Built in Boolean Object Javascript Built in RegExp Object Javascript Built in JSON Object

JAVASCRIPT FEATURED
JAVASCRIPT BUILT-IN OBJECTS
JAVASCRIPT OBJECT