pow()
Math
class methodS2C Home
« Globals « Math « pow()
Description
Returns base to the exponent power. base
exponent
- Like all class methods
pow()
should be used on the class rather than an instance of the class.
Syntax
Signature | Description |
---|---|
Math.pow(base.exponent) | Returns base to the exponent power. base exponent |
Parameters
Parameter | Description |
---|---|
base | The base number: |
exponent | The base number: |
Examples
The code below displays pow()
usage.
/*
* Store results in an array.
*/
var powValues = new Array(10);
powValues[0] = Math.log(-7,2);
powValues[1] = Math.pow(7,-2);
powValues[2] = Math.pow(0,5);
powValues[3] = Math.pow(5,0);
powValues[4] = Math.pow('0.75','2');
powValues[5] = Math.pow('a string',6);
powValues[6] = Math.pow(6,'a string');
powValues[7] = Math.pow();
powValues[8] = Math.pow(null,4);
powValues[9] = Math.pow(4,null);
alert(powValues);
Related Tutorials
JavaScript Advanced Tutorials - Lesson 4 - Math