Others



JavaScript Math.pow()


The Math.pow(x) method used to returns the numeric value of a base raised to the power.

Syntax
Math.pow(b,p)

Here, pow() is a static method. Hence, we use it as Math.pow().

Parameters
  • b - Required. The base number.
  • p - Required. The exponent number.
Return Value
  • Number - value of b to the power of p. (bp)
Example
console.log(Math.pow(2,3));  //8
console.log(Math.pow(2,4));  //16
console.log(Math.pow(-2,3));  //-8
console.log(Math.pow(-2,4));  //16
console.log(Math.pow(10,3));  //1000
Try it Yourself

JavaScript Math Functions