紮根數字
平方根
使用 Math.sqrt()
查找數字的平方根
placeholderCopyMath.sqrt(16) #=> 4
立方根
要查詢數字的立方根,請使用 Math.cbrt()
函式
Version >= 6
placeholderCopyMath.cbrt(27) #=> 3
尋找第 n 根
要查詢第 n 個根,請使用 Math.pow()
函式並傳入小數指數。
placeholderCopyMath.pow(64, 1/6) #=> 2