JavaScript sinh

The JavaScript sinh function is a Math function that is used to calculate the trigonometric hyperbolic Sine for the specified expression. The syntax of the sinh function is:

Math.sinh(number);

We can achieve the same result using the exp function.

(Math.exp(number) – Math.exp(- number)) / 2

JavaScript sinh Example

In this example, we find the hyperbolic Sine values for different data types and display the output. Use the exp Function in JavaScript to deliver the same sinh result.

<!DOCTYPE html>
<html>
<head>
    <title> JavaScriptSINHFunction </title>
</head>
<body>
  <h1> JavaScriptSINHFunction </h1>
  <p id = "Pos"></p>
  <p id = "Neg"></p>
  <p id = "Dec"></p>
  <p id = "Neg_Dec"></p>
  <p id = "Str"></p>
  <p id = "Exp"></p>
  <p id = "Null"></p>
  <p id = "Multi"></p>
  <script>
    document.getElementById("Pos").innerHTML = Math.sinh(1);
    document.getElementById("Neg").innerHTML = Math.sinh(-2);
    document.getElementById("Dec").innerHTML = Math.sinh(4.45);
    document.getElementById("Neg_Dec").innerHTML = Math.sinh(-2.75);
    document.getElementById("Str").innerHTML = Math.sinh("JavaScript");
    document.getElementById("Null").innerHTML = Math.sinh(null);
    document.getElementById("Multi").innerHTML = Math.sinh(2 + 9 - 7);
  </script>
</body>
</html>
JavaScript sinh Function Example

TIP: Please refer to the sin(), asin, and asinh() methods to find the JavaScript Sine and hyperbolic arc sine values.

Example 2: In this example, we use the Math.sinh function with positive and negative Infinity values.

let a = Infinity;
let b = -Infinity;
console.log(Math.sinh(a));
console.log(Math.sinh(b));
Infinity 
-Infinity

Example 3: In this example, we use the Math.sinh() function on non-numeric values. Here, we are trying to find the hyperbolic sine value of a string. As we know, the sinh() method only accepts integer values; it returns NaN as output.

let a = "hi";
console.log(Math.sinh(a));
NaN

How to find the sinh value in degrees in JavaScript?

First, we must convert the given degrees into radians and then apply the sinh() function on the radian value. For more information about remaining trigonometric functions, visit the Math functions article.

function calcDeg(degrees) 
{
const radians = degrees * (Math.PI / 180);
return Math.sinh(radians);
}

console.log(calcDeg(30));
console.log(calcDeg(45));
console.log(calcDeg(60));
console.log(calcDeg(90));
0.5478534738880397 
0.8686709614860095 
1.2493670505239751 
2.3012989023072947