This JavaScript tutorial explains how to use the math feature called atanh() with syntax and examples.
Description
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.
Syntax
In JavaScript, the syntax for the atanh() function is:
Math.atanh(number);
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.
Returns
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.
Note
Math is a placeholder object that contains mathematical functions and constants of which atanh() is one of these functions.
Example
Let’s take a seem to be at an example of how to use the atanh() function in JavaScript.
For example:
console.log(Math.atanh(0.8));
console.log(Math.atanh(1));
console.log(Math.atanh(-1));
console.log(Math.atanh(2));
console.log(Math.atanh(-2));
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:
1.0986122886681098
Infinity
-Infinity
NaN
NaN
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.
Leave a Review