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

瀏覽器相容性

另見