How to use Math
Math Object Properties
Math has mathematical formulas and information.
PROPERTY | Value | DESCRIPTION |
---|---|---|
Math.E | 2.718281828459045091 | The value of e, the base of the natural logarithms |
Math.LN10 | 2.302585092994045901 | The natural logarithm of 10 |
Math.LN2 | 0.6931471805599452862 | The natural logarithm of 2 |
Math.LOG2E | 1.442695040888963387 | The base 2 logarithm of e |
Math.LOG10E | 0.4342944819032518167 | The base 10 logarithm of e |
Math.PI | 3.141592653589793116 | The value of pMath.SQRT1_2 The square root of 1/2 |
Math.SQRT2 | 1.414213562373095145 | The square root of 2 |
Math Object Methods
METHOD | DESCRIPTION |
---|---|
Math.abs(num) | Returns the absolute value of (num) |
Math.acos(x) | Returns the arc cosine of x |
Math.asin(x) | Returns the arc sine of x |
Math.atan(x) | Returns the arc tangent of x |
Math.atan2(y, x) | Returns the arc tangent of y/x |
Math.ceil() | the ceiling function. |
Math.cos(x) | Returns the cosine of x |
Math.exp(num) | Returns Math.E raised to the power of (num) |
Math.floor() | the floor function. |
Math.log(num) | Returns the natural logarithm of (num) |
Math.max | Returns the maximun value in the list |
Math.min | Returns the minimun value in the list |
Math.pow(num,power) | Returns num raised to the power of power |
Math.random() | returns a random number between the 0 and the 1, not including either 0 or 1. |
Math.round() | a round function. |
Math.sin(x) | Returns the sine of x |
Math.sqrt(num) | Returns the square root of (num) |
Math.tan(x) | Returns the tangent of x |