Math.pow()
Category:Math
This function is useful if you need to raise a base number to a power.
Examples
Example 1
// Prints the value from taking a base of 2 and raising it to the power of 3. The value 8 is printed into the console.
console.log(Math.pow(2, 3));
Example 2
// Prints the value from taking a base of 7 and raising it to the power of 10. The value 282475249 is printed into the console.
console.log(Math.pow(7, 10));
Syntax
Math.pow(base, exponent)
Returns
A floating-point number that represents the value of `base` taken to the power of `exponent`
Tips
- Math.pow() only accepts numbers as parameters.
Found a bug in the documentation? Let us know at support@code.org.