How to Use the Math.pow() Method in JavaScript

Web Dev
Sponsored links

In this article, I will introduce how to use the Math.pow() method in JavaScript.

The Math.pow() method

The Math.pow() method returns returns the result of calculating the power.

The syntax is below.

Math.pow(base, exponent)

This method returns the specified base to the specified exponent power, as in base^exponent.


Math.pow(2, 2); // 4
Math.pow(2, 10); // 1024
Math.pow(4, 0.5); // 2
Math.pow(8, 1/3);  // 2
Math.pow(8, -1/3); // 0.5