JavaScript Math.asinh() Method

Shubham Vora Jan 30, 2023
  1. Syntax of JavaScript Math.asinh() Method
  2. Example 1: Invoke the Math.asinh() Method on Numeric Parameter Values
  3. Example 2: Invoke the Math.asinh() Method on Infinity Values
  4. Example 3: Invoke the Math.asinh() Method on Non-Numeric Parameter Values
JavaScript Math.asinh() Method

We can use the Math.asinh() method to get the arc-sine value of the numberValue. To calculate the hyperbolic sine of the number, users can use the expression ln(numberValue + ((numberValue)^2+1)^(-½).

Syntax of JavaScript Math.asinh() Method

let number = 2;
Math.asinh(numberValue);

Parameters

numberValue - The Math.asinh() calculates the hyperbolic sine for the numberValue value.

Return

It returns the hyperbolic sine value of the numberValue.

Example 1: Invoke the Math.asinh() Method on Numeric Parameter Values

In the example below, we have invoked the Math.asinh() method on different numberValue. Users can observe the output for the positive and negative numberValue.

let numValue = 0.3;
let numValue2 = -0.3;
console.log(Math.asinh(numValue));
console.log(Math.asinh(numValue2));
console.log(Math.asinh(0));
console.log(Math.asinh(30));

Output:

0.29567304756342244
-0.29567304756342244
0
4.09462222433053

Example 2: Invoke the Math.asinh() Method on Infinity Values

We have created two variables in the example below, which store the Infinity and -Infinity values. Also, we passed it as a parameter of the Math.asinh() method.

Users can see that method gives the same result as the numberValue parameter value.

let numValue = Infinity;
let numValue2 = -Infinity;
console.log(Math.asinh(numValue));
console.log(Math.asinh(numValue2));

Output:

Infinity
-Infinity

Example 3: Invoke the Math.asinh() Method on Non-Numeric Parameter Values

When we use the non-numeric value as a numberValue parameter, Math.asinh() method always returns the NaN value.

In the example below, we have passed string, character, and NaN values as a parameter, and the method returns NaN for all values.

let numValue = "Delft";
let numValue2 = NaN;
console.log(Math.asinh(numValue));
console.log(Math.asinh(numValue2));
console.log(Math.asinh('a'));

Output:

NaN
NaN
NaN

We can use the Math.asinh() method with all modern browsers to get the hyperbolic sine value of a parameter value.

Author: Shubham Vora
Shubham Vora avatar Shubham Vora avatar

Shubham is a software developer interested in learning and writing about various technologies. He loves to help people by sharing vast knowledge about modern technologies via different platforms such as the DelftStack.com website.

LinkedIn GitHub

Related Article - JavaScript Math