The pow() method returns the value of x to the power of y (x^y).
The pow() method returns the value of x to the power of y (x^y).
Math.pow(x,y)
Parameter | Require | Description |
---|---|---|
x | Required. | The base |
y | Required. | The exponent |
A Number, representing the value of x to the power of y
Return the value of the number 4 to the power of 3 (4*4*4):
//display the result of 4*4*4. console.log(Math.pow(4, 3));/*from w w w . j a v a 2 s. c o m*/ //Use the pow() method on different numbers: var a = Math.pow(0, 1); var b = Math.pow(11, 1); var c = Math.pow(11, 10); var d = Math.pow(3, 3); var e = Math.pow(-3, 3); var f = Math.pow(2, 4); var x = a + "\n" + b + "\n" + c + "\n" + d + "\n" + e + "\n" + f; console.log(x);