basic

Math.pow

Returns base raised to the power of exponent. In modern code the `**` operator (ES2016) is usually preferred for readability and identical semantics.

Math.pow(base, exponent)

Parameters & edge cases

Case Behavior
base The base number
exponent The power; can be fractional (roots) or negative (reciprocals)
** operator `base ** exponent` is the modern equivalent — same result, no lookup

Examples

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

2 to the 10th.

console.log(Math.pow(2, -1));  // 0.5

Negative exponent yields reciprocal.

console.log(Math.pow(4, 0.5)); // 2

Fractional exponent computes a root — here, the square root.

console.log(2 ** 10);          // 1024

ES2016 exponent operator, identical result.

Gotcha

Math.pow(-1, 0.5) returns NaN (no real root). Math.pow THROWS TypeError on BigInt arguments — use the `**` operator (e.g. `2n ** 10n`) for BigInt exponentiation.

Related

← All JS Math methods · Array methods