JavaScript pow()Method

Math 对象参考手册JavaScript Math Object

Example

Return 4 to the power of 3 (4*4*4):

Math.pow(4,3);

Output:

64

Try it Yourself »

Definition and Usage

The pow() method returns the value of x to the power of y.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the pow() method


Syntax

Math.pow(x,y)

Parameter Values

Parameter Description
x Required. The base. Must be a number.
y Required. The exponent. Must be a number.

Return Value

Type Description
Number x to the power of y.

Technical Details

JavaScript Version: 1.0


More Examples

Example

In the following example, we will apply pow() to different number combinations:

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);

a,b,c,d,e, and f output result:

0
1
1
27
-27
16

Try it Yourself »


Math 对象参考手册JavaScript Math Object

Other Extensions