pow() JavaScript math function

pow is a math function in JavaScript to get to the power value of an integer. Here is the syntax
Math.pow(x,y)
We will try some examples.
<script language='JavaScript' type='text/JavaScript'>
<!--
document.write(Math.pow(5,5)); // output is 3125
document.write("<br>");
document.write(Math.pow(0,0)); // output is 1
document.write("<br>");
document.write(Math.pow(0,1)); // output is 0
document.write("<br>");
document.write(Math.pow(1,0)); // output is 1
document.write("<br>");
document.write(Math.pow(1,1)); // output is 1
document.write("<br>------------<br>");
document.write(Math.pow(2,2)); // output is 4
document.write("<br>");
document.write(Math.pow(2,-2)); // output is 0.25
document.write("<br>");
document.write(Math.pow(-2,2)); // output is 4
document.write("<br>");
document.write("<br>------------<br>");
//-->
</script>
By using for loop we can develop one table , here is sample code
for(i=0;i<5;i++){
for(j=0;j<5;j++){
document.write(Math.pow(j,i)+",");
}
document.write("<br>");
}
exp() to get E to the power x value
JavaScript Math Reference
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer