Javascript Math Pow Function

by top54u.com 21 Jul, 2008

Math Pow function of Javascript calculates the value of base with exponential power. Math.pow Javascript function accepts two parameters x,y; first parameter x accepts value for base and second parameter y accepts value for power. Javascript Math.pow function evaluates the value for xy i.e. x power y or multiply base x for y times.

 

Syntax for Javascript Math Pow Function

 

Math.pow(x,y);

Math pow function in the above syntax shows that pow function accepts two parameters. First parameter works as base to the second parameter as power.

 

Examples of Javascript Math Pow Function

 

<script language="javascript" type="text/javascript">

document.write(Math.pow(2,4) + "<br />");

 

document.write(Math.pow(4,2) + "<br />");

 

document.write(Math.pow(9,3) + "<br />");

 

document.write(Math.pow(-9,3) + "<br />");

 

document.write(Math.pow(-9,2) + "<br />");

 

</script>

 

Output:

16
16
729
-729
81

Above example shows the use of different sets of numbers with Javascript Math.pow function and returns the product of base x for y times.

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

10/11/2008 3:18:12 AM




related videos.....
recent posts.....
top54u ezines.....