Math.sqrt()

WE can get square root of any number by using sqrt() math function. Syntax is here
Math.sqrt(x) ;
We will see some examples.
<script language='JavaScript' type='text/JavaScript'>
<!--
document.write(Math.sqrt(4)); // output is 2
document.write("<br>");
document.write(Math.sqrt(64)); // output is 8
document.write("<br>");
document.write(Math.sqrt(9)); // output is 3
document.write("<br>");
document.write(Math.sqrt(27)); // output is 5.196152422706632
document.write("<br>");
document.write(Math.sqrt(0.36)); // output is 0.6
document.write("<br>------------<br>");
document.write(Math.sqrt(-64)); // output is Nan
document.write("<br>");
document.write(Math.sqrt(-9)); // output is NaN
//-->
</script>
Visitors Rating
Your Rating





Post Comment This is for short comments only. Use the forum for more discussions.




HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer