Using Math atanh() function to coding in Javascript/JS

This JavaScript tutorial explains how to use the math feature called atanh() with syntax and examples.


In JavaScript, atanh() is a characteristic that is used to return the hyperbolic arc tangent (also referred to as inverse hyperbolic tangent) of a number. Because the atanh() function is a static characteristic of the Math object, it need to be invoked through the placeholder object known as Math.


In JavaScript, the syntax for the atanh() function is:


Parameters or Arguments

number The quantity used to calculate the hyperbolic arc tangent. The quantity have to be much less than 1 and increased than -1.


The atanh() characteristic returns the hyperbolic arc tangent of a number.

If the variety is 1, the atanh() characteristic will return Infinity.

If the number is -1, the atanh() feature will return -Infinity.

If the variety is increased than 1 or the quantity is much less than -1, the atanh() characteristic will return NaN.


Math is a placeholder object that contains mathematical functions and constants of which atanh() is one of these functions.


Let’s take a seem to be at an example of how to use the atanh() function in JavaScript.

For example:


In this example, we have invoked the atanh() function the use of the Math class.

We have written the output of the atanh() feature to the web browser console log, for demonstration purposes, to exhibit what the atanh() characteristic returns.

The following will be output to the net browser console log:


In this example, the first output to the console log back 1.0986122886681098 which is the hyperbolic arc tangent of 0.8.

The 2d output to the console log returned Infinity due to the fact the variety provided was once 1.

The 1/3 output to the console log lower back -Infinity due to the fact the quantity supplied was once -1.

The fourth and fifth output to the console log back NaN because the number provided was once larger than 1 or much less than -1.