## Math

The Math object holds a set of constants and methods that enable more complex mathematical operations than the basic arithmetic operators. We can not instantiate a Math Object. The Math object is static so it‟s properties and methods are accessed directly.

Ex:-
Math.PI
Math.abs( )

## Properties

• E Returns Euler’s number (approx. 2.718)
• LN2 Returns the natural logarithm of 2 (approx. 0.693)
• LN10 Returns the natural logarithm of 10 (approx. 2.302)
• LOG2E Returns the base-2 logarithm of E (approx. 1.442)
• LOG10E Returns the base-10 logarithm of E (approx. 0.434)
• PI Returns PI (approx. 3.14)
• SQRT1_2 Returns the square root of 1/2 (approx. 0.707)
• SQRT2 Returns the square root of 2 (approx. 1.414)

## Methods

• Math.abs(arg) Returns the absolute value of arg
• Math.acos(arg) Returns the arccosine of arg, in radians
• Math.acosh(arg) Returns the hyperbolic arccosine of arg
• Math.asin(arg) Returns the arcsine of arg, in radians
• Math.asinh(arg) Returns the hyperbolic arcsine of arg
• Math.atan(arg) Returns the arctangent of arg as a numeric value between -PI/2 and PI/2 radians
• Math.atan2(arg1, arg2) Returns the arctangent of the quotient of its arguments
• Math.atanh(arg) Returns the hyperbolic arctangent of arg

## Methods

• Math.cbrt(arg) Returns the cubic root of arg
• Math.ceil(arg) Returns arg, rounded upwards to the nearest integer
• Math.cos(arg) Returns the cosine of arg (arg is in radians)
• Math.cosh(arg) Returns the hyperbolic cosine of arg
• Math.exp(arg) Returns the value of Ex
• Math.floor(arg) Returns arg, rounded downwards to the nearest integer
• Math.log(arg) Returns the natural logarithm (base E) of arg
• Math.random() Returns a random number between 0 and 1
• Math.round(arg) Rounds arg to the nearest integer

## Methods

• Math.max(arg1, arg2, …,arg_n) Returns the number with the highest value
• Math.min(arg1, arg2, …,arg_n) Returns the number with the lowest value
• Math.pow(arg1, arg2) Returns the value of arg to the power of arg2
• Math.sin(arg) Returns the sine of arg (arg is in radians)
• Math.sinh(arg) Returns the hyperbolic sine of arg
• Math.sqrt(arg) Returns the square root of arg
• Math.tan(arg) Returns the tangent of an angle
• Math.tanh(arg) Returns the hyperbolic tangent of a number
• Math.trunc(arg) Returns the integer part of a number (arg)

Tagged : / / /