Math.pow()

JavaScript 1.0+, ECMAScript 1.0+, JScript 1.0+ Nav2+, NES2+, IE 3+, Opera3+ Syntax

							math.pow(num1, num2)

Description

The pow() method of the Math object is used to calculate an exponent power.

Example

Listing 6.169 shows how the pow() method is used.

Listing 6.169 Example of the pow() Method
 <html> <body> <script language="JavaScript"> <!–– Hide // function takes two numbers and calculates the // exponential power. function doMath(){ var inputNum1=document.form1.input1.value; var inputNum2=document.form1.input2.value; var result = Math.pow(inputNum1, inputNum2); document.form1.answer.value = result; } // End Hide ––> </script> <form name=form1> Enter Base number: <input type="text" name="input1" size=10> <br> Enter exponent ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.