Visit Mozilla.org

Core JavaScript 1.5 Reference:Global Objects:Math:pow

From MDC


Contents

[edit] Summary

Returns base to the exponent power, that is, baseexponent.

Method of Math

Static

Implemented in: JavaScript 1.0, NES 2.0
ECMA Version: ECMA-262

[edit] Syntax

Math.pow(base,exponent)

[edit] Parameters

base 
The base number.
exponents 
The exponent to which to raise base.

[edit] Description

Because pow is a static method of Math, you always use it as Math.pow(), rather than as a method of a Math object you created.

[edit] Examples

[edit] Example: Using Math.pow

function raisePower(x,y) {
   return Math.pow(x,y)
}

If x is 7 and y is 2, raisePower returns 49 (7 to the power of 2).

[edit] See Also

exp, log