title: using the digits of a number as an array
body: <pre><code>var number = 342345820139586830203845861938475676
  var output = []
  
  var sum = 0;
  while (number) {
      output.push(number % 10);
      number = Math.floor(number/10);
  }
  
  output = output.reverse();
  
  
  function addTerms () {
      for (i = 0; i &lt; output.length; i=i+2) {
      var term = Math.pow(output[i], output[i+1]);
      sum += term;
  
  }
  return sum;
  }
  
  document.write(output);
  document.write("&lt;br&gt;");
  document.write(addTerms());
  </code></pre>
  
  <p>I am trying to take that large number and split it into its digits. Then, find the sum of the the first digit raised to the power of the 2nd, 3rd digit raiseed to the 4th, 5th raised to the 6th and so on. for some reason, my array is returning weird digits, causing my sum to be off. the correct answer is 2517052. Thanks</p>