To get the square root, use the Math.sqrt() method. This method returns the square root of a number. If the value of a number is negative, sqrt returns NaN.
Example
You can try to run the following code to get the square root of a number −
<html> <head> <title>JavaScript Math sqrt() Method</title> </head> <body> <script> var value = Math.sqrt( 0.5 ); document.write("First Value : " + value ); var value = Math.sqrt( 49 ); document.write("<br />Second Value : " + value ); </script> </body> </html>