JS Built-ins
← Math82 / 215
Mathcbrtbeginner

Math.cbrt(-8) Equals -2

πŸ“– Usage Example
// Cube root β€” works with negatives too
Math.cbrt(27)   // β†’ 3
Math.cbrt(-8)   // β†’ -2

Use Math.cbrt() to find the cube root of any real number, including negative values.

Math.cbrt(x)

Unlike square roots, cube roots of negative numbers are real. Math.cbrt(-8) returns -2.

Challenge: Use Math.cbrt() on a negative number.

πŸ’‘ Hints (2)
  • β€’ (-2)Β³ = -8, so cbrt(-8) = -2
  • β€’ Unlike Math.sqrt, Math.cbrt works with negative inputs