Math.sqrt() Method is used to return the square root of a number.
Syntax:
Math.sqrt(x)
Example:
<script> var one = Math.sqrt(3); document.writeln('Output of 3 : ' + one + '</br></br>'); var two = Math.sqrt(-4); document.writeln('Output of -4 : ' + two + '</br></br>'); var three = Math.sqrt(9); document.writeln('Output of 9 : ' + three + '</br></br>'); var four = Math.sqrt(15); document.writeln('Output of 15 : ' + four + '</br></br>'); </script>
Output
Output of 3 : 1.7320508075688772 Output of -4 : NaN Output of 9 : 3 Output of 15 : 3.872983346207417