Parameters or Arguments
number The range used to calculate the hyperbolic tangent.
The tanh() function returns the hyperbolic tangent of a number.
Math is a placeholder object that includes mathematical features and constants of which tanh() is one of these functions.
console.log(Math.tanh(0.8)); console.log(Math.tanh(1)); console.log(Math.tanh(-5));
In this example, we have invoked the tanh() function the usage of the Math class.
We have written the output of the tanh() feature to the web browser console log, for demonstration purposes, to exhibit what the tanh() feature returns.
The following will be output to the internet browser console log:
0.6640367702678491 0.7615941559557649 -0.9999092042625951
In this example, the first output to the console log returned 0.6640367702678491 which is the hyperbolic tangent of 0.8.
The 2nd output to the console log returned 0.7615941559557649 which is the hyperbolic tangent of 1.
The 0.33 output to the console log back -0.9999092042625951 which is the hyperbolic tangent of -5.