WEB DEVELOPER SITE
×

# JavaScript Math Reference

## Math Object

The Math object enables you to perform scientific tasks.

Math isn't a constructor. All properties/techniques for Math can be called by utilizing Math as an article, without making it.

## Syntax

var x = Math.PI;           /Returns PI
var y = Math.sqrt(16);     /Returns the square foundation of 16

## Math Object Properties

Property Description
E Returns Euler's number (approx. 2.718)
LN2 Returns the regular logarithm of 2 (approx. 0.693)
LN10 Returns the regular 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 foundation of 1/2 (approx. 0.707)
SQRT2 Returns the square foundation of 2 (approx. 1.414)

## Math Object Methods

Method Description
abs(x) Returns the outright estimation of x
acos(x) Returns the arccosine of x, in radians
asin(x) Returns the arcsine of x, in radians
atan(x) Returns the arctangent of x as a numeric incentive between - PI/2 and PI/2 radians
atan2(y,x) Returns the arctangent of the remainder of its arguments
ceil(x) Returns x, adjusted upwards to the closest integer
cos(x) Returns the cosine of (x is in radians)
exp(x) Returns the estimation of Ex
floor(x) Returns x, adjusted downwards to the closest integer
log(x) Returns the common logarithm (base E) of x
max(x,y,z,...,n) Returns the number with the most astounding value
min(x,y,z,...,n) Returns the number with the most minimal value
pow(x,y) Returns the estimation of x to the intensity of y
random() Returns an arbitrary number somewhere in the range of 0 and 1
round(x) Rounds x to the closest integer
sin(x) Returns the sine of (x is in radians)
sqrt(x) Returns the square base of x
tan(x) Returns the digression of an angle