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>
exp() to get E to the power x value →
←JavaScript Math Reference
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
plus2net.com
Math Functions in JavaScript