Math.atanh()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Die statische Methode Math.atanh()
gibt den inversen hyperbolischen Tangens einer Zahl zurück. Das bedeutet,
Probieren Sie es aus
console.log(Math.atanh(-1));
// Expected output: -Infinity
console.log(Math.atanh(0));
// Expected output: 0
console.log(Math.atanh(0.5));
// Expected output: 0.549306144334055 (approximately)
console.log(Math.atanh(1));
// Expected output: Infinity
Syntax
js
Math.atanh(x)
Parameter
x
-
Eine Zahl zwischen -1 und 1, einschließlich.
Rückgabewert
Beschreibung
Da atanh()
eine statische Methode von Math
ist, verwenden Sie sie immer als Math.atanh()
und nicht als Methode eines selbst erstellten Math
-Objekts (denn Math
ist kein Konstruktor).
Beispiele
Verwendung von Math.atanh()
js
Math.atanh(-2); // NaN
Math.atanh(-1); // -Infinity
Math.atanh(-0); // -0
Math.atanh(0); // 0
Math.atanh(0.5); // 0.5493061443340548
Math.atanh(1); // Infinity
Math.atanh(2); // NaN
Spezifikationen
Specification |
---|
ECMAScript® 2026 Language Specification # sec-math.atanh |