Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Python Programs
    • Java Programs
    • SQL FAQ’s

JavaScript CBRT

by suresh

The JavaScript CBRT function is one of the Math functions and it is used to find the cube root of a specified expression or an individual number. The basic syntax of the JavaScript CBRT Function is:

Math.cbrt(number);

Number: It can be a number or a valid numerical expression.

  • If the number argument is positive or Negative number, CBRT() function will return the cube root of a given value.
  • If the number argument is not a number, CBRT() function will return NaN.
  • When the number argument is Null, CBRT() function will return Zero.

JavaScript CBRT Function Example

The JavaScript CBRT function is used to find the cube root of a given number. In this example, We are going to find the cube root of different data types and display the output

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript CBRT Function </title>
</head>
<body>
  <h1> JavaScript CBRT Function </h1>
  <p id = "Pos"></p>
  <p id = "Neg"></p>
  <p id = "Dec"></p>
  <p id = "Neg_Dec"></p>
  <p id = "Str"></p>
  <p id = "Null"></p>
  <script>
    document.getElementById("Pos").innerHTML = Math.cbrt(10);
    document.getElementById("Neg").innerHTML = Math.cbrt(-10);
    document.getElementById("Dec").innerHTML = Math.cbrt(14.05);
    document.getElementById("Neg_Dec").innerHTML = Math.cbrt(-6.05);
    document.getElementById("Str").innerHTML = Math.cbrt("JavaScript");
    document.getElementById("Null").innerHTML = Math.cbrt(null);
  </script>
</body>
</html>

ANALYSIS

  1. First two statements, We used the CBRT Function directly on both the Positive integer and negative integer. From the below screenshot you can observe that, the CBRT() Function is returning the cube roots.
  2. Next two statements, We used the JavaScript CBRT Function on both the Positive and negative Decimal values this Function is working fine with decimal values as well.
  3. Next statement, We tried CBRT Math function on String value. As we said before, this will return NaN (Not a Number) as output
  4. Last, We tried CBRT() Function on Null value and it return Zero as output

OUTPUT

JavaScript CBRT Function

Placed Under: JavaScript

  • SQL DML, DDL, DCL & TCL Cmds
  • SQL NOT EXISTS Operator
  • SQL UPDATE from SELECT
  • SQL AFTER UPDATE Triggers
  • SQL Get Column Names in Table
  • SQL IF ELSE
  • SQL ACID Properties
  • SQL FOR XML PATH
  • Java Two Dimensional Array
  • Java Perfect Number Program
  • Java Count Digits in a Number
  • C Compare Two Strings Program
  • C Print Prime Numbers 1 to 100
  • C program to Reverse a String
  • C Palindrome Number Program
  • C Program for Palindrome String
  • C Remove Duplicate String Chars
  • C Square of a Number Program
  • C Sum and Average of N Number
  • Python Fibonacci Series program
  • Python Area Of Circle Program
  • Python Prime Numbers 1 to 100
  • Python Program for Leap Year
  • Tableau Rank Calculation
  • Tableau Google Maps usage
  • Power BI Format Dates
  • Power BI Top 10 Filters
  • Power BI – Create Hierarchy
  • Power BI DAX Math Functions
  • Learn SSIS in 28 Days
  • SSIS Transformations
  • SSIS Incremental Load
  • SSRS Drill Through Reports
  • SSRS Drill Down Reports
  • R Programming Tutorial
  • C Tutorial
  • C# Tutorial
  • Java Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • MySQL Tutorial
  • SQL Server Tutorial
  • R Tutorial
  • Power BI Tutorial
  • Tableau Tutorial
  • SSIS Tutorial
  • SSRS Tutorial
  • Informatica Tutorial
  • Talend Tutorial
  • C Programs
  • C++ Programs
  • Java Programs
  • Python Programs
  • MDX Tutorial
  • SSAS Tutorial
  • QlikView Tutorial

Copyright © 2021 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy