Javascript Math Reference
Javascript Math.pow
The Math.pow(x,y) returns the value of x power y.
<html> <body> <script type="text/javascript"> <!-- /* ******************************************************** Example - Usage of Math.pow ******************************************************** */ var x =4, y =3; var z = Math.pow(x,y); document.write ("Math.pow(4,3) is : " + z); //--> </script> </body> </html> |
Math.pow takes two arguments and returns one value value. You may like to try this program online here . Make changes in the program and see its results.
As a practical example, try to calculate the value of a $1000 deposit after 5 years, if the rate of yearly interest is 6%. Use the following formula
M = $1000 x ( 1 + R/100) n
Where R is the rate of interest and n is the number of years
Here is one way, the above exercise has been implemented Real Life Math.abs example . Make sure you see this example once you have given your fair try.