--- title: Math.cbrt() slug: Web/JavaScript/Reference/Global_Objects/Math/cbrt tags: - JavaScript - Math - Method - Reference translation_of: Web/JavaScript/Reference/Global_Objects/Math/cbrt ---
Die Funktion Math.cbrt()
gibt die Kubikwurzel einer Zahl zurück:
Math.cbrt(x)
x
Die Kubikwurzel der übergebenen Zahl.
Weil cbrt()
eine statische Methode von Math
ist, muss diese immer mit Math.cbrt()
genutzt werden, ohne dass ein Objekt von Math erstellt wird (Math
ist kein Konstruktor).
Math.cbrt()
Math.cbrt(NaN); // NaN
Math.cbrt(-1); // -1
Math.cbrt(-0); // -0
Math.cbrt(-Infinity); // -Infinity
Math.cbrt(0); // 0
Math.cbrt(1); // 1
Math.cbrt(Infinity); // Infinity
Math.cbrt(null); // 0
Math.cbrt(2); // 1.2599210498948734
Für gilt so dass diese Funktion wie folgt emuliert werden kann:
if (!Math.cbrt) {
Math.cbrt = function(x) {
var y = Math.pow(Math.abs(x), 1/3);
return x < 0 ? -y : y;
};
}
Spezifikation | Status | Kommentar |
---|---|---|
{{SpecName('ES6', '#sec-math.cbrt', 'Math.cbrt')}} | {{Spec2('ES6')}} | Initiale Definition. |
{{SpecName('ESDraft', '#sec-math.cbrt', 'Math.cbrt')}} | {{Spec2('ESDraft')}} |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("javascript.builtins.Math.cbrt")}}