Math.cbrt
Returns the cube root of a number
Syntax
Math.cbrt(x)Parameters
| Parameter | Type | Description |
|---|---|---|
| x | number | A number |
Return Value
The cube root of x
Examples
console.log(Math.cbrt(27)); // 3
console.log(Math.cbrt(64)); // 4
console.log(Math.cbrt(-8)); // -2console.log(Math.cbrt(1)); // 1
console.log(Math.cbrt(0)); // 0const values = [8, 27, 64, 125];
const roots = values.map(Math.cbrt);
console.log(roots); // [2, 3, 4, 5]Understanding Math.cbrt
The Math.cbrt method in JavaScript returns the cube root of a number. It belongs to the Math object and is one of the most widely used methods for working with math values in modern JavaScript and TypeScript applications.
The method signature is Math.cbrt(x). It accepts 1 parameter: x. When called, it returns the cube root of x. Understanding when and how to use cbrt() helps you write more expressive, readable code.
Common use cases for Math.cbrt include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like math-sqrt, math-pow, enabling you to chain operations together for complex data manipulation pipelines.
Browser support for Math.cbrt is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.
Browser Compatibility
Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.
Related Methods
More Math Methods
Other methods in the Math object
Related Tools
More Math Methods
Explore JavaScript Methods
Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.