Math Object |
Previous Top Next |
The Math Object in Javascript
Math Constructors
None.
Math Properties
E |
Euler's constant and the base of natural logarithms |
LOG2E |
base 2 logarithm of E |
LOG10E |
base 10 logarithm of E |
LN2 |
natural log of 2 |
LN10 |
natural log of 10 |
PI |
ratio of the circumference of a circle to its diameter |
SQRT2 |
square root of 2 |
SQRT1_2 |
square root of 1/2 |
Math Methods
abs(value) |
returns the absolute value of value |
acos(value) |
returns the arc cosine of value |
asin(value) |
returns the arc sine of value |
atan(value) |
returns the arc tangent of value |
atan2(valueX, valueY) |
returns the angle (in radians) from the x axis to a point(x,y) |
ceil(value) |
returns the smallest integer greater than or equal to value |
cos(value) |
returns the cosine of value |
exp(value) |
returns E to the power of value |
floor(value) |
returns the largest integer less than or equal to value |
log(value) |
returns the natural log of value |
max(value1, value2) |
returns the maximum value of value1 and value2 |
min(value1, value2) |
returns the minimum value of value1 and value2 |
pow(base, exponent) |
returns base to the power of exponent |
random() |
returns a random number between 0 and 1 |
round(value) |
returns value rounded to the nearest integer |
sin(value) |
returns the sine of value |
sqrt(value) |
returns the square root of value |
tan(value) |
returns the tangent of value |