Math.sinh()

Baseline 已广泛支持

此特性已相当成熟,可在许多设备和浏览器版本上使用。自 ⁨2015 年 7 月⁩以来,各浏览器均已提供此特性。

Math.sinh() 静态方法返回一个数字的双曲正弦。即:

𝙼𝚊𝚝𝚑.𝚜𝚒𝚗𝚑(𝚡)=sinh(x)=exex2\mathtt{\operatorname{Math.sinh}(x)} = \sinh(x) = \frac{\mathrm{e}^x - \mathrm{e}^{-x}}{2}

试一试

console.log(Math.sinh(0));
// Expected output: 0

console.log(Math.sinh(1));
// Expected output: 1.1752011936438014

console.log(Math.sinh(-1));
// Expected output: -1.1752011936438014

console.log(Math.sinh(2));
// Expected output: 3.626860407847019

语法

js
Math.sinh(x)

参数

x

一个数字。

返回值

x 的双曲正弦。

描述

因为 sinh()Math 的静态方法,所以您总是使用 Math.sinh() 的方式来调用它,而不是通过您创建的 Math 对象的方法来调用(Math 不是构造函数)。

示例

使用 Math.sinh()

js
Math.sinh(-Infinity); // -Infinity
Math.sinh(-0); // -0
Math.sinh(0); // 0
Math.sinh(1); // 1.1752011936438014
Math.sinh(Infinity); // Infinity

规范

规范
ECMAScript® 2026 语言规范
# sec-math.sinh

浏览器兼容性

另见