Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript pow() method

JavaScript pow() method

Math Object Reference JavaScript Math object

Example

Returns 4 to the power of 3 (444):

Math.pow(4,3);

Output result:

64

Try it »


Definition and Usage

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


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the pow() method


Syntax

Math.pow(

x

,

y

)

Parameter value

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

Output of a, b, c, d, e, and f:

0

1

1

27

-27

16

Try it »


Math Object Reference JavaScript Math object