--- title: Math.cbrt() slug: Web/JavaScript/Reference/Global_Objects/Math/cbrt tags: - ECMAScript 2015 - JavaScript - Math - Méthode - Reference - polyfill translation_of: Web/JavaScript/Reference/Global_Objects/Math/cbrt original_slug: Web/JavaScript/Reference/Objets_globaux/Math/cbrt ---
La fonction Math.cbrt() renvoie la racine cubique (le nom anglais étant cubic root) d'un nombre :
Math.cbrt(x)
xLa racine cubique du nombre passé en argument.
cbrt() étant une méthode statique de Math, il faut utiliser Math.cbrt(), et non pas la méthode d'un autre objet créé (Math n'est pas un constructeur).
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.2599210498948732
| Spécification | État | Commentaires |
|---|---|---|
| {{SpecName('ES6', '#sec-math.cbrt', 'Math.cbrt')}} | {{Spec2('ES6')}} | Définition initiale. |
| {{SpecName('ESDraft', '#sec-math.cbrt', 'Math.cbrt')}} | {{Spec2('ESDraft')}} |
{{Compat("javascript.builtins.Math.cbrt")}}