JavaScript Math sinh() Method

JavaScript Math sinh() method is used to calculate the hyperbolic sine of a number.

Formula

π™ΌπšŠπšπš‘.πšœπš’πš—πš‘(𝚑)=sinh(x )=exβˆ’eβˆ’x2

Syntax

Math.sinh(num) 

Parameters

num(required): It is the number for which you want to calculate the hyperbolic sine.

Return Value

Return the hyperbolic sine of a number.

If the passed value is non-numeric or empty, the method returns NaN.

Visual Representation

Visual Representation of JavaScript Math sinh() Method

Example 1: How to Use Math sinh() Method

let a = 2;   //positive number
let b = -2;  //negative number
let c = 3.7; //float number
let d = 0;

console.log(Math.sinh(a));
console.log(Math.sinh(b));
console.log(Math.sinh(c));
console.log(Math.sinh(d));

Output

3.626860407847019
-3.626860407847019
20.21129041679853
0

Example 2: Handling empty and Non-numeric valueVisual Representation of Handling empty and Non-numeric value

console.log(Math.sinh("Ronaldo")); //non-numeric value
console.log(Math.sinh()); //empty value

Output

NaN
NaN

Example 3: Passing InfinityVisual Representation of Passing Infinity

console.log(Math.sinh(Infinity));   
console.log(Math.sinh(-Infinity));

Output

Infinity
-Infinity

Browser Compatibility

  1. Google Chrome 38 and above
  2. Firefox 25 and above
  3. Opera 25 and above
  4. Safari 8 and above
  5. Edge 12 and above

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.