JavaScript Math sinh() method

The sinh function in JavaScript computes the hyperbolic sine of a specified number.

Syntax

The sinh function is expressed through the syntax outlined below:

Example

Math.sinh(num)

Parameter

num - A number.

Return

The hyperbolic sine of a number.

JavaScript Math sinh method example

In this section, we will explore the sinh function by examining a variety of examples.

Example 1

Let's see a simple example of sinh method.

Example

<script>

document.writeln(Math.sinh(-1)+"<br>");

document.writeln(Math.sinh(0)+"<br>");

document.writeln(Math.sinh(0.5)+"<br>");

document.writeln(Math.sinh(2));

</script>

Output:

Output

-1.1752011936438014

0

0.5210953054937474

3.626860407847019

Example 2

In this section, you have the opportunity to evaluate the sinh function using your own custom test cases.

Example

<script>

function display()

{

  var x=document.getElementById("num").value;

document.getElementById("result").innerHTML=Math.sinh(x);

}

</script>

<form>

  Enter a number: <input type="text" id="num">

  <input type="button"  onclick="display()" value="submit">

  </form>

  <p><span id="result"></span></p>

Input Required

This code uses input(). Please provide values below: