Adscend

Click Here



Click Here

Tuesday

Math sqrt Function

Math Function sqrt

Syntax
Math.sqrt(x)

1.Math.sqrt(x) takes a number as an argument and returns the square root of that number.

2.The argument is a numeric expression.

3.If a negative number is passed through the argument, for instance Math.sqrt(-9) , the function will return NaN.


Example
<script type="text/javascript">
var n = prompt("Enter a number");
var answer = Math.sqrt(n);
alert("The square root of" +n+ "is" +answer);
</script>