Home >>JavaScript Math Reference >JavaScript cbrt() Method

JavaScript cbrt() Method

JavaScript cbrt() Method

JavaScript cbrt() method is used to return the cubic root of a given input number. It accepts only a single parameter which is the number whose cube root is to be found.

Syntax:
Math.cbrt(x)

Parameter Values

Parameter Description
x This is a required parameter. It defines the given input number.

Browser Support

Method Chrome Edge Firefox Safari Opera
cbrt() 38 12 25 8 25
Here is an example of JavaScript cbrt() method:
<html>
<body>
<p>Click the button to see the Output:</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
  document.getElementById("demo").innerHTML = Math.cbrt(27);
}
</script>
</body>
</html>
Output:

Click the button to see the Output:

Example 2:
<html>
<body>
<p>Click the button to see the Output:</p>
<button onclick="myFunction1()">Try it</button>
<p id="demo1"></p>
<script>
function myFunction1() {
  document.getElementById("demo1").innerHTML = Math.cbrt(216);
}
</script>
</body>
</html>
Output:

Click the button to see the Output:


No Sidebar ads