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             
廣告
© . All rights reserved.