Friday, October 17, 2025
HomeLanguagesJavascriptJavaScript Math cbrt() Function

JavaScript Math cbrt() Function

The Javascript Math.cbrt() function is used to find the cube root of a number. The cube root of a number is denoted as Math.cbrt(x)=y such that y^3=x. 

Syntax:

Math.cbrt(number)

Parameters: This function accepts a single parameter.

  • number: The number whose cube root you want to know. 

Return Value: It returns the cube root of the given number.

The below example will give you an idea of cbrt() function:

Example 1: When a positive number is passed as a parameter. 

Javascript




<script type="text/javascript">
    console.log("Output : " + Math.cbrt(8));        
</script>


Output:

Output : 2

Example 2: When a negative number is passed as a parameter. 

Javascript




<script type="text/javascript">
    console.log("Output : " + Math.cbrt(-8));        
</script>


Output:

Output : -2

Example 3: When zero is passed as a parameter. 

Javascript




<script type="text/javascript">
    console.log("Output : " + Math.cbrt(0));        
</script>


Output:

Output : 0

Example 4: When infinity is passed as a parameter. 

Javascript




<script type="text/javascript">
    console.log("Output : " + Math.cbrt(infinity));        
</script>


Output:

Output : Infinity

We have a complete list of Javascript Math Objects methods, to check those please go through this Javascript Math Object Complete reference article.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS