There are five methods related to exponents in the Math class as shown in the following table.
Method | Description |
---|---|
exp(x) | Returns e raised to power of x. |
log(x) | Returns the natural logarithm of x. |
log10(x) | Returns the base 10 logarithm of x. |
pow(a, b) | Returns a raised to the power of b. |
sqrt(x) | Returns the square root of x. |
Math.exp(1) //2.71828 Math.log(Math.E) //1.0 Math.log10(10) //1.0 Math.pow(2, 3) //8.0 Math.pow(3, 2) //9.0 Math.pow(4.5, 2.5) //22.91765 Math.sqrt(4) //2.0 Math.sqrt(10.5) //4.24