SQL PHP HTML ASP JavaScript articles and free scripts to download

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>");
}


Google+

Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked




Join Our Email List
Email:  
For Email Newsletters you can trust
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer