JavaScript Math sinh()

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


// hyperbolic sine of 1
let number = Math.sinh(1);

// Output: 1.1752011936438014

sinh() Syntax

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


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()

// hyperbolic sine of negative number let number1 = Math.sinh(-1);
// hyperbolic sine of zero let number2 = Math.sinh(0);
// hyperbolic sine of positive number let number3 = Math.sinh(2);
console.log(number3); // Output: // -1.1752011936438014 // 0 // 3.626860407847019

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

// sinh() with positive infinity let number1 = Math.sinh(Infinity);
console.log(number1); // Output: Infinity
// sinh() with negative infinity let number2 = Math.sinh(-Infinity);
console.log(number2); // Output: -Infinity

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

let string = "Harry";

// sinh() with a string argument let value = Math.sinh(string);
console.log(value); // Output: NaN

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.

Also Read:

Did you find this article helpful?