JavaScript Math sinh()

The sinh() method computes the hyperbolic sine of the specified number and returns it.

Example


sinh() Syntax

The syntax of the Math.sinh() method is:

Math.sinh(number)

Here, sinh() is a static method. Hence, we are accessing the method using the class name, Math.


sinh() Parameter

The sinh() method takes a single parameter:

  • number - whose hyperbolic sine is to be calculated

sinh() Return Value

The sinh() method returns:

  • hyperbolic sine of the given argument number
  • NaN (Not a Number) for a non-numeric argument

Example1: JavaScript Math.sinh()

In the above example, the Math.sinh() method computes the hyperbolic sine of

  • -1 (negative number) - results in -1.1752011936438014
  • 0 (zero) - results in 0
  • 2 (positive number) - results in 3.626860407847019

Note: Mathematically, the hyperbolic sine is equivalent to (ex - e-x)/2.


Example 2: Math.sinh() with Infinity Values


Example 3: Math.sinh() with Non-Numeric Argument

In the above example, we have tried to calculate the hyperbolic sine value of the string "Harry". That's why we get NaN as the output.


Recommended readings: