Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript tanh() Method

JavaScript tanh() Method

Math Object Reference JavaScript Math object

Example

Return the hyperbolic tangent of a number:

let x = Math.tanh(1);

Output result:

0.7615941559557649

Try it »


Definition and Usage

The tanh() function returns the hyperbolic tangent of a number, using the formula below:


Browser support

Chrome Edge Firefox Safari Opera
Yes Yes Yes Yes Yes

Syntax

Math.tanh(

x

)

Parameter value

Parameters Description
x Required. The number to be calculated.

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 Object Reference JavaScript Math object