ES6 - Math cbrt() 函式



此方法返回一個數字的立方根。

語法

Math.cbrt ( x );   

引數

  • x − 代表一個數字

返回值

返回數字的立方根。

示例

console.log("---Math.cbrt()---") 
console.log("Math.cbrt(27) : "+Math.cbrt(27)) 
console.log("Math.cbrt(22) : "+Math.cbrt(22))         

輸出

---Math.cbrt()--- 
Math.cbrt(27) : 3 
Math.cbrt(22) : 2.802039330655387             
廣告
© . All rights reserved.