JavaScript Math.asinh()

Posted by

Function

Introduction to the JavaScript Math.asinh() Function

The Math.asinh() function is an inbuilt function in JavaScript which is used to calculate the hyperbolic arc sine of a number and returns its value in radians.

It is an inverse function for the Math.sinh() function and takes the hyperbolic sine of a number and returns its inverse hyperbolic sine.

This function is part of the JavaScript Math object and can be accessed using the Math namespace.

Syntax

The syntax of the Math.asinh() function is given below.

[dm_code_snippet background=”yes” background-mobile=”yes” slim=”no” line-numbers=”no” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]

Math.asinh(x)

[/dm_code_snippet]

Here, x is a number whose hyperbolic arc sine needs to be calculated.

Return Value

The Math.asinh() function returns the hyperbolic arc sine of a number in radians.

Example 1

In the below example, the Math.asinh() function is used to calculate the hyperbolic arc sine of a number.

[dm_code_snippet background=”yes” background-mobile=”yes” slim=”no” line-numbers=”no” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]

// app.js

let num = 0.5;

let result = Math.asinh(num);

console.log("The hyperbolic arc sine of " + num + " is " + result);

// Output
// The hyperbolic arc sine of 0.5 is 0.48121182505960347

[/dm_code_snippet]

Here, the Math.asinh() function is used to calculate the hyperbolic arc sine of 0.5 and the result is stored in the result variable.

Example 2

In the below example, the Math.asinh() function is used to calculate the hyperbolic arc sine of a negative number.

[dm_code_snippet background=”yes” background-mobile=”yes” slim=”no” line-numbers=”no” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]

// app.js

let num = -0.5;

let result = Math.asinh(num);

console.log("The hyperbolic arc sine of " + num + " is " + result);

// Output
// The hyperbolic arc sine of -0.5 is -0.48121182505960347

[/dm_code_snippet]

Here, the Math.asinh() function is used to calculate the hyperbolic arc sine of -0.5 and the result is stored in the result variable.

Conclusion

In conclusion, the Math.asinh() function is an inbuilt function in JavaScript which is used to calculate the hyperbolic arc sine of a number and returns its value in radians.