ES6 - Math Pow() 函数

此方法返回底数的指数幂,即底数的幂指数。

语法

Math.pow(x, y)

参数

  • x − 表示底数
  • y − 表示指数

返回值

返回底数的指数幂。

示例

console.log("---Math.pow()---") 
console.log("math.pow(2,3) : "+Math.pow(2, 3)) 
console.log("Math.pow(1.7, 2.3) : "+Math.pow(1.7, 2.3))            

输出

---Math.pow()--- 
math.pow(2,3) : 8 
Math.pow(1.7, 2.3) : 3.388695291147646