JavaScript Math.cbrt() Method
The Math.cbrt() static method returns the cube root of a number.
Description
The Math.cbrt() static method returns the cube root of a number. Unlike x ** (1/3), it handles negative numbers correctly.
Cube roots appear in volume calculations, such as finding the side length of a cube from its volume, and in some colour-space conversions. Results can show tiny floating point errors for numbers that aren't perfect cubes.
It returns NaN for values that can't be converted to numbers, and keeps the sign of zero and infinity. Like every member of Math, it's called on the Math object itself rather than on a number, and it only works with the Number type: passing a BigInt throws a TypeError.
Syntax
Math.cbrt(x)Parameters
- xA number.
Return Value
The cube root of x.
Example
Browser Support
The following information will show you the current browser support for the Math.cbrt() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





