JavaScript - Math.cbrt() Method
The JavaScript Math.cbrt() method returns the cube root of the given number.
Syntax
Math.cbrt(x)
Parameters
x |
Specify a number. |
Return Value
Returns the cube root of the specified number.
Example:
In the example below, Math.cbrt() method is used to find out the cube root of the given number.
var txt; txt = "Math.cbrt(27) = " + Math.cbrt(27) + "<br>"; txt = txt + "Math.cbrt(64) = " + Math.cbrt(64) + "<br>"; txt = txt + "Math.cbrt(100) = " + Math.cbrt(100) + "<br>"; txt = txt + "Math.cbrt(-27) = " + Math.cbrt(-27) + "<br>";
The output (value of txt) after running above script will be:
Math.cbrt(27) = 3 Math.cbrt(64) = 4 Math.cbrt(100) = 4.641588833612779 Math.cbrt(-27) = -3
❮ JavaScript - Math Object