JavaScript Math.pow() Method
The Math.pow() static method returns a base number raised to a power. The ** operator does the same thing.
Description
The Math.pow() static method returns the base raised to the exponent. The exponentiation operator ** is equivalent and usually shorter: Math.pow(2, 10) is the same as 2 ** 10. Fractional exponents give roots, and negative exponents give reciprocals.
Some combinations return NaN, such as a negative base with a fractional exponent, because the result isn't a real number. Any number raised to the power 0 is 1, including NaN ** 0.
Unlike the ** operator, Math.pow() doesn't work with BigInts, so use ** for those. It's still useful when you need a function reference, for example to pass to reduce() or map(). Arguments are converted to numbers first, so numeric strings work, while values that can't be converted give NaN.
Syntax
Math.pow(base, exponent)Parameters
- baseThe base number.
- exponentThe power to raise it to.
Return Value
base raised to the power exponent.
Example
Browser Support
The following information will show you the current browser support for the Math.pow() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





