const num = 100;
const sqrt = Math.sqrt(num);
In the code snippet we are calculating the square root of a number which has 100 as value. We are passing this variable to the Math.sqrt() function of javascript and it is returning the value 10.
Math.sqrt() method in javascript is used to get the square root value of a number. It takes the number as the required parameter. The syntax is as below.
Math.sqrt(number)
Live Demo
A live demo for this getting square root of the number is as below.
Math.sqrt(100);
Math.sqrt(200);
Math.sqrt(50);
Math.sqrt(60)
0 Comments