JavaScript (ES2026) reference · Math Methods and Constants
JavaScript Math.pow() Method
Return a base raised to an exponent. The ** operator does the same: Math.pow(2, 10) equals 2 ** 10.
JavaScript (ES2026) Since ES1
Syntax
Math.pow(base, exponent)
Parameters
| Parameter | Description |
|---|---|
base |
The base. |
exponent |
The power. |
Return value
A number.
Examples
console.log(Math.pow(2, 10), 2 ** 10, Math.pow(9, 0.5));
Output
1024 1024 3
const principal = 1000, rate = 0.05, years = 10;
console.log((principal * Math.pow(1 + rate, years)).toFixed(2));
Output
1628.89
Version history
| Version | Change |
|---|---|
| JavaScript ES1 | Added |
In other languages
pow()· Python
Related
Math.sqrt()· Return the square root of a number, or NaN for negative numbers. Use it for distances and the Pythagorean theorem.Math.cbrt()· Return the cube root of a number; unlike Math.pow(x, 1/3) it works for negative numbers.Math.exp()· Return e (about 2.718) raised to the given power, used for exponential growth, decay and probability formulas.- JavaScript Math · tutorial
- JavaScript Numbers · tutorial