JavaScript pow () method
Definition and Usage
pow () method returns the x power of y.
Browser Support
All major browsers support pow () method
grammar
Math.pow( x , y )
Parameter Value
参数 | 描述 |
---|---|
x | 必需。底数。必须是数字。 |
y | 必需。幂数。必须是数字。 |
return value
类型 | 描述 |
---|---|
Number | x 的 y 次幂。 |
technical details
JavaScript version: | 1.0 |
---|
More examples
Examples
In the following example, we'll pow () to use a different combination of numbers:
var a=Math.pow(0,1);
var b=Math.pow(1,1);
var c=Math.pow(1,10);
var d=Math.pow(3,3);
var e=Math.pow(-3,3);
var f=Math.pow(2,4);
var b=Math.pow(1,1);
var c=Math.pow(1,10);
var d=Math.pow(3,3);
var e=Math.pow(-3,3);
var f=Math.pow(2,4);
a, b, c, d, e, and f output:
0
1
1
27
-27
16
1
1
27
-27
16
try it"