THE WORLD'S LARGEST WEB DEVELOPER SITE

JavaScript pow() Method

Math Object Reference JavaScript Math Object

Example

Return the value of the number 4 to be the power of 3 (4*4*4):

Math.pow(4, 3);

The result will be:

64

Try it yourself »

More "Try it Yourself" examples below.


Definition and Usage

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


Browser Support

Method
pow() Yes Yes Yes Yes Yes

Syntax

Math.pow(x,y)

Parameter Values

Parameter Description
x Required. The base
y Required. The exponent

Technical Details

Return Value: A Number, representing the value of x to the power of y (xy)
JavaScript Version: 1.0

Examples

More Examples

Example

Use the pow() method on different 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);

The result of a,b,c,d,e, and f will be:

0
1
1
27
-27
16

Try it yourself »

Math Object Reference JavaScript Math Object

COLOR PICKER

colorpicker

SHARE THIS PAGE






Search w3schools.com:

Translate w3schools.com: