Javascript Math Pow Function

Updated on 21 Mar 2012,
Published on 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

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

// 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. 

Continue to next tutorial: Javascript Math Number Add to learn how to add the numeric value of two variables.

2 Responses to "Javascript Math Pow Function"
Hi.Iam Benson.How are u.
Hi baby.I love Math.pow!
Leave a Comment
* required
* required
* will not be published
* optional
* hint:
  • Subscribe via Email