sqrt Function :-
Returns the square root of a number.
Suntax :-
sqrt(number)
Description :-
If the value of
number is negative,sqrt returns NaN. Because sqrt is a static method of Math,you always use it as Math.sqrt(), rather than as a method of a Math object you created.Example:
<html>
<head>
<title>Calculate Squareroot</title>
<script language="javascript">
function calcsqrt()
{
var value=f1.sqrt.value;
alert("The Squareroot of " + value + " is " + Math.sqrt(value));
}
</script>
</head>
<body>
<form name="f1">
<input type="text" name="sqrt" value="Enter Number" size="20">
<input type="button" value="Calculate" onclick="calcsqrt()">
</form>
</body>
</html>