Chrome Extension

Calculate square root of a number using javascript

To find the square root of a number you can use Math.sqrt() function of javascript. It will return the square root value of the given number.
const num = 100;
const sqrt = Math.sqrt(num);
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Output
10

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() function

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.

More Examples

Math.sqrt(100);
Math.sqrt(200);
Math.sqrt(50);
Math.sqrt(60)

Search Index Data (The code snippet can also be found with below search text)

Math.sqrt() method in javascript
Was this helpful?
0 Comments