Trusted answers to developer questions

Arslan Bajwa

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

** Math** is a built-in object in JavaScript that contains different methods and properties used to perform mathematical operations. It contains a function

`tanh()`

`Math.tanh(param);`

`param`

: This is the angle for which we want to compute the hyperbolic tangent. Its type is`Number`

, and it is measured in*radians*.

in JavaScript is a`Number`

64-bit double-precisionvalue which is the same as`double`

in C# or Java.

`Number`

: It returns the hyperbolic tangent of the given angle stored in`param`

. It is of the`Number`

type.`1`

: The function returns this for*positive*`Infinity`

.`-1`

: The function returns this for*negative*`Infinity`

.

To convert degrees to radians use the following formula:

- Radians = Degrees x
`π`

/180where

`π`

= 3.14159, approximately.

console.log("tanh(-1) = " + Math.tanh(-1));console.log("tanh(0) = " + Math.tanh(0));console.log("tanh(1) = " + Math.tanh(1));console.log("tanh(∞) = " + Math.tanh(Infinity));console.log("tanh(-∞) = " + Math.tanh(-Infinity));

RELATED TAGS

javascript

math

tanh

communitycreator

CONTRIBUTOR

Arslan Bajwa

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring

Related Courses