title: iterate over an array and sum up all values with JS
body: <p>as the title says i'm trying to sum up using a for loop to iterate over an array.
  can you give me some pointers as to where i'm going wrong here. i am returning the value NaN.</p>
  
  <pre><code>var total = 0;
  
  function sum(input) {
      for (idx=0; idx&lt;=input; idx++) {
          total += input[idx];
      }
      return total;
  }
  </code></pre>