📅  最后修改于: 2023-12-03 15:16:05.816000             🧑  作者: Mango
The Math.pow()
function in JavaScript is used to compute the power of a base number raised to an exponent. It takes two arguments: the base and the exponent.
Math.pow(base, exponent)
base
: The base number.exponent
: The exponent which the base number will be raised to.The result of the base number raised to the exponent.
console.log(Math.pow(2, 3)); // Output: 8
console.log(Math.pow(10, 2)); // Output: 100
console.log(Math.pow(8, 0)); // Output: 1
In the first example, we use Math.pow()
to compute 2 raised to the power of 3, which returns 8. In the second example, we compute 10 raised to the power of 2, which returns 100. In the third example, we compute 8 raised to the power of 0, which returns 1.