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 |
浏览器兼容性
加载中…