Thursday, September 4, 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
32260 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6625 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6694 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS