# Using Math tanh() function to coding in Javascript/JS

This JavaScript tutorial explains how to use the math characteristic referred to as tanh() with syntax and examples.

## Description

In JavaScript, tanh() is a feature that is used to return the hyperbolic tangent of a number. Because the tanh() characteristic is a static function of the Math object, it should be invoked via the placeholder object known as Math.

## Syntax

In JavaScript, the syntax for the tanh() feature is:

``Math.tanh(number);``

Parameters or Arguments

number The range used to calculate the hyperbolic tangent.

## Returns

The tanh() function returns the hyperbolic tangent of a number.

## Note

Math is a placeholder object that includes mathematical features and constants of which tanh() is one of these functions.

## Example

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

For example:

``````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.