Encodera

Thanks for reading!

Donate to the site — we work hard for you.

JavaScript reference

Math.pow

Raises a number to a power.

Available since: ES1

Syntax

Math.pow(base, exponent)

Parameters

ParameterTypeDescription
basenumberThe base.
exponentnumberThe exponent.

Return value

numberbase raised to the power of exponent.

Examples

Two to the power of ten:

console.log(Math.pow(2, 10));

Output:

1024

The same with the ** operator:

console.log(2 ** 10);
console.log(9 ** 0.5);

Output:

1024
3

Notes

Modern code usually uses the ** operator: it is shorter and works the same way.

See also

In the tutorial

  • Numbers — Numbers in JavaScript — integers and fractions, rounding, the Math object, toFixed and the special values Infinity and NaN.

Thanks for reading!

Donate to the site — we work hard for you.