Math.acosh()
Math.acosh() 靜態方法返回一個數字的逆雙曲餘弦值。也就是說,
試一試
console.log(Math.acosh(0.999999999999));
// Expected output: NaN
console.log(Math.acosh(1));
// Expected output: 0
console.log(Math.acosh(2));
// Expected output: 1.3169578969248166
console.log(Math.acosh(2.5));
// Expected output: 1.566799236972411
語法
js
Math.acosh(x)
引數
x-
大於或等於 1 的數字。
返回值
x 的逆雙曲餘弦值。如果 x 小於 1,則返回 NaN。
描述
因為 acosh() 是 Math 的一個靜態方法,所以你總是使用 Math.acosh() 來呼叫它,而不是作為你建立的 Math 物件的成員方法(Math 不是一個建構函式)。
示例
使用 Math.acosh()
js
Math.acosh(0); // NaN
Math.acosh(1); // 0
Math.acosh(2); // 1.3169578969248166
Math.acosh(Infinity); // Infinity
規範
| 規範 |
|---|
| ECMAScript® 2026 語言規範 # sec-math.acosh |
瀏覽器相容性
載入中…