Math.pow(base, exponent) Last updated: 24. Jan 2023
Returns the value of a base raised to a power
Parameters
Name | Type | Description |
---|---|---|
base | number | The base number |
exponent | number | The exponent number |
Returns
A number representing base taken to the power of exponent.
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.write(Math.pow(7, 2)); // 49
write("\n");
write(Math.pow(7, 3)); // 343
write("\n");
write(Math.pow(2, 10)); // 1024
write("\n");
Output
The JS code above produces the output shown below:49
343
1024