Math.pow()
syntax: |
Math.pow(x, y) |
where: |
x - The number which will be raised to the power of Y
y - The number which X will be raised to
|
return: |
number - the value of x to the power of y.
|
description: |
If the result of Math.pow() is an imaginary or complex number, NaN will be returned. Please note that if Math.pow() unexpectedly returns infinity, it may be because the floating-point value has experienced overflow.
|
example: |
//x to the power of y is returned //in the following function: function compute_x_to_power_of_y(x, y) { return Math.pow(x, y) } //If the result of Math.pow is //an imaginary or complex number, //the return is NaN //If y is NaN, the result is NaN //If y is +0 or -0, the result is 1, //even if x is NaN //If x = 2 and y = 3 the return value is 8 |