JavaScript Math.sinh()
Syntax & Examples
Math.sinh() static-method
The Math.sinh() static method in JavaScript returns the hyperbolic sine of a number. The number is assumed to be in radians.
Syntax of Math.sinh()
The syntax of Math.sinh() static-method is:
Math.sinh(x)
This sinh() static-method of Math returns the hyperbolic sine of the given number x, where x is in radians.
Parameters
Parameter | Optional/Required | Description |
---|---|---|
x | required | A number representing an angle in radians whose hyperbolic sine is to be calculated. |
Return Type
Math.sinh() returns value of type Number
.
✐ Examples
1 Using Math.sinh() with a positive number
In JavaScript, we can use the Math.sinh()
method to calculate the hyperbolic sine of a positive number.
For example,
- We pass the number
1
to theMath.sinh()
method. - The result is approximately
1.1752011936438014
. - We log the result to the console using the
console.log()
method.
JavaScript Program
const result = Math.sinh(1);
console.log(result);
Output
1.1752011936438014
2 Using Math.sinh() with a negative number
In JavaScript, we can use the Math.sinh()
method to calculate the hyperbolic sine of a negative number.
For example,
- We pass the number
-1
to theMath.sinh()
method. - The result is approximately
-1.1752011936438014
. - We log the result to the console using the
console.log()
method.
JavaScript Program
const result = Math.sinh(-1);
console.log(result);
Output
-1.1752011936438014
3 Using Math.sinh() with zero
In JavaScript, we can use the Math.sinh()
method to calculate the hyperbolic sine of zero.
For example,
- We pass the number
0
to theMath.sinh()
method. - The result is
0
. - We log the result to the console using the
console.log()
method.
JavaScript Program
const result = Math.sinh(0);
console.log(result);
Output
0
Summary
In this JavaScript tutorial, we learned about sinh() static-method of Math: the syntax and few working examples with output and detailed explanation for each example.