title: Why am I getting NaN when adding all arguments?
body: <p>I am trying to create a function that adds all arguments together. I keep getting <code>NaN</code>. What am I doing wrong?</p>
  
  <pre><code>function sum() {
         var n = arguments.length;
         var total = 0;
      for(var i = 0; i &lt; n; i++) {
          // code here
          total += n[i];
      }
      return total;
  }
  
  sum(1,2,3,4);
  </code></pre>