Math.pow()

  • Revision slug: JavaScript/Reference/Global_Objects/Math/pow
  • Revision title: pow
  • Revision id: 88069
  • Created:
  • Creator: Kyodev
  • Is current revision? No
  • Comment add link fr

Revision Content

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

Syntax

Math.pow(base,exponent)

Parameters

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

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.

Examples

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

See Also

exp, log

{{ wiki.languages( { "fr": "fr/R\u00e9f\u00e9rence_de_JavaScript_1.5_Core/Objets_globaux/Math/pow", "pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/Obiekty/Math/pow" } ) }}

Revision Source

<p>
</p>
<h3 name="Summary"> Summary </h3>
<p>Returns <code>base</code> to the <code>exponent</code> power, that is, <code>base<sup>exponent</sup></code>.
</p>
<table class="fullwidth-table">
<tbody><tr>
<td class="header" colspan="2">Method of <a href="en/Core_JavaScript_1.5_Reference/Objects/Math">Math</a></td>
</tr>
<tr>
<td colspan="2">
<p><b>Static</b>
</p>
</td>
</tr>
<tr>
<td>Implemented in:</td>
<td>JavaScript 1.0, NES 2.0</td>
</tr>
<tr>
<td>ECMA Version:</td>
<td>ECMA-262</td>
</tr>
</tbody></table>
<h3 name="Syntax"> Syntax </h3>
<p><code>
Math.pow(<i>base</i>,<i>exponent</i>)
</code>
</p>
<h3 name="Parameters"> Parameters </h3>
<dl><dt> <code>base</code> </dt><dd> The base number.
</dd></dl>
<dl><dt> <code>exponents</code> </dt><dd> The exponent to which to raise <code>base</code>.
</dd></dl>
<h3 name="Description"> Description </h3>
<p>Because <code>pow</code> is a static method of <code>Math</code>, you always use it as <code>Math.pow()</code>, rather than as a method of a <code>Math</code> object you created.
</p>
<h3 name="Examples"> Examples </h3>
<h4 name="Example:_Using_Math.pow"> Example: Using <code>Math.pow</code> </h4>
<pre>function raisePower(x,y) {
   return Math.pow(x,y)
}
</pre>
<p>If <code>x</code> is 7 and <code>y</code> is 2, raisePower returns 49 (7 to the power of 2).
</p>
<h3 name="See_Also"> See Also </h3>
<p><a href="en/Core_JavaScript_1.5_Reference/Objects/Math/exp">exp</a>,
<a href="en/Core_JavaScript_1.5_Reference/Objects/Math/log">log</a>
</p>{{ wiki.languages( { "fr": "fr/R\u00e9f\u00e9rence_de_JavaScript_1.5_Core/Objets_globaux/Math/pow", "pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/Obiekty/Math/pow" } ) }}
Revert to this revision