JavaScript (ES2026) reference · Math Methods and Constants
JavaScript Math.cbrt() Method
Return the cube root of a number; unlike Math.pow(x, 1/3) it works for negative numbers.
JavaScript (ES2026) Since ES2015
Syntax
Math.cbrt(x)
Parameters
| Parameter | Description |
|---|---|
x |
A number. |
Return value
A number.
Examples
console.log(Math.cbrt(27), Math.cbrt(-8));
Output
3 -2
console.log(Math.pow(-8, 1 / 3), Math.cbrt(-8));
Output
NaN -2
Version history
| Version | Change |
|---|---|
| JavaScript ES2015 | Added |
Related
Math.sqrt()· Return the square root of a number, or NaN for negative numbers. Use it for distances and the Pythagorean theorem.Math.pow()· Return a base raised to an exponent. The ** operator does the same: Math.pow(2, 10) equals 2 ** 10.- JavaScript Math · tutorial
- JavaScript Numbers · tutorial