The Math has a lot of methods related to various mathematical operations.
METHOD | DESCRIPTION |
---|---|
Math.abs (num) | Returns the absolute value of (num ) |
Math.exp (num) | Returns Math.E raised to the power of (num ) |
Math.log (num) | Returns the natural logarithm of (num ) |
Math.pow (num, power) | Returns num raised to the power of power |
Math.sqrt (num) | Returns the square root 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.cos(x) | Returns the cosine of x |
Math.sin(x) | Returns the sine of x |
Math.tan(x) | Returns the tangent of x |
console.log(Math.abs(-1)); console.log(Math.sqrt(2));