JavaScript tanh()Method

Math 对象参考手册JavaScript Math Object

Examples

Return the hyperbolic tangent of a number:

let x = Math.tanh(1);

Output:

0.7615941559557649

Try it Yourself »

Definition and Usage

The tanh() function returns the hyperbolic tangent of a number. The formula is as follows:


Browser Support

Chrome Edge Firefox Safari Opera
Yes Yes Yes Yes Yes

Syntax

Math.tanh(x)

Parameter Values

Parameter Description
x Required. The number to be computed.

Return Value

Type Description
Number The hyperbolic tangent of the given number.

Technical Details

JavaScript Version: 1.0


More Examples

Math.tanh(0);        // 0
Math.tanh(Infinity); // 1
Math.tanh(1);        // 0.7615941559557649


Math 对象参考手册JavaScript Math Object

Other Extensions