Math.sinh()
概述
Math.sinh()
函数返回一个数字 (单位为角度) 的双曲正弦值。
语法
Math.sinh(x)
参数
x
-
任意数字 (单位为度).
描述
双曲正弦的图像如下:
示例
js
Math.sinh(0); // 0
Math.sinh(1); // 1.1752011936438014
Math.sinh("-1"); // -1.1752011936438014
Math.sinh("foo"); // NaN
规范
Specification |
---|
ECMAScript Language Specification # sec-math.sinh |
Polyfill
该函数可以使用 Math.exp()
函数来实现:
js
function sinh(x) {
return (Math.exp(x) - Math.exp(-x)) / 2;
}
浏览器兼容性
BCD tables only load in the browser