title: Exponents without Math.pow() JavaScript
body: <p>I need to write a program that takes two integers base and exponents and compute the exponents without using Math.Pow(). I have created the code using the Math.pow() method I can't figure out how to make it work without it. I have tried base^exp but it doesn't give me the right answer. Thanks in advance!</p>
  
  <p>/* Write a JavaScript function named intPow that reads two numbers named base and exp from two text fields. Assume that the second number will always be an integer greater than or equal to 1. Your function should not use any of the built in Math functions such as Math.pow. Your function should use a loop to compute the value of baseexp meaning base raised to the power of exp. Your function must output the result of baseexp to a div. Hint: write your function to compute 1 multiplied by base exp times. */</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html lang="en-us"&gt;
  
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;Integer Power&lt;/title&gt;
  &lt;script type="text/javascript"&gt;
      /* Write a JavaScript function named intPow that reads two numbers named base and exp from two text fields. Assume that the second number will always be an integer greater than or equal to 1. Your function should not use any of the built in Math functions such as Math.pow. Your function should use a loop to compute the value of baseexp meaning base raised to the power of exp. Your function must output the result of baseexp to a div. Hint: write your function to compute 1 multiplied by base exp times. */
      function intPow() {
          var base = parseFloat(document.getElementById("baseBox").value);
          var exp = parseFloat(document.getElementById("expBox").value);
          var output = "";
          var i = 0;
          for (i = 1; i &lt;= exp; i++) {
              output = Math.pow(base, exp);
          }
          document.getElementById("outputDiv").innerHTML = output;
      }
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;h1&gt;Find the power of &lt;i&gt;Base&lt;/i&gt; by entering an integer in the &lt;i&gt;base&lt;/i&gt; box, and an integer in the &lt;i&gt;exponent&lt;/i&gt; box.&lt;/h1&gt; Base:
  &lt;input type="text" id="baseBox" size="15"&gt; Exponents:
  &lt;input type="text" id="expBox" size="15"&gt;
  &lt;button type="button" onclick="intPow()"&gt;Compute Exponents&lt;/button&gt;
  &lt;div id="outputDiv"&gt;&lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;`
  </code></pre>