JavaScript pow() Method
Example
Return the value of the number 4 to the power of 3 (4*4*4):
Math.pow(4, 3);
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: | ECMAScript 1 |
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);
Try it Yourself »