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

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

Math.cbrt(x)

Parameters

ParameterDescription
x A number.

Return value

A number.

Examples

Cube rootsTry it yourself
console.log(Math.cbrt(27), Math.cbrt(-8));

Output

3 -2
pow() returns NaN for negativesTry it yourself
console.log(Math.pow(-8, 1 / 3), Math.cbrt(-8));

Output

NaN -2

Version history

VersionChange
JavaScript ES2015Added

Was this page helpful?