JS Built-ins
← Math210 / 215
Mathtanhbeginner

Math.tanh() β€” Return Type

πŸ“– Usage Example
// Hyperbolic tangent (output in (-1, 1))
Math.tanh(0)   // β†’ 0
Math.tanh(1)   // β†’ 0.7615...

Use Math.tanh() to compute the hyperbolic tangent, commonly used as an activation function in neural networks.

Math.tanh()

Returns the hyperbolic tangent of a number.

Challenge: Confirm that Math.tanh() always returns a JavaScript number.

πŸ’‘ Hints (1)
  • β€’ Math.tanh always returns a number primitive