Math.pow()

Returns the base raised to the power of the exponent.

Since ES1 Spec ↗

Syntax

Math.pow(base, exponent)

Parameters

NameTypeRequiredDescription
base number Yes The base number.
exponent number Yes The exponent to raise the base to.

Returns

number — base ** exponent, or NaN for invalid inputs (e.g. negative base with fractional exponent).

Examples

console.log(Math.pow(2, 10));
Output
1024
console.log(Math.pow(9, 0.5));
Output
3

Notes

The `**` operator is the modern equivalent (`2 ** 10`). A negative base with a non-integer exponent returns NaN.

Browser & runtime support

EnvironmentSince version
chrome 1.0
firefox 1.0
safari 1.0
edge 12
node 0.10

See also