Categories
Web development

JavaScript Math.cbrt()

JavaScript Math.cbrt()

The JavaScript Math.cbrt() returns the cubic root of a number.

Syntax:

Math.cbrt(x)

Example:

<!DOCTYPE html>
<html>
<body>

<button onclick="cbrtExample()">Try it</button>
<p id="cbrt-example"></p>

<script>
function cbrtExample() {
  document.getElementById("cbrt-example").innerHTML = Math.cbrt(216);
}
</script>

</body>
</html>

Output:

Click the button to display the cubic root of 216


Enjoy coding!

Read also:

JavaScript Introduction

JavaScript HTML DOM

JavaScript Math Object