title: How to call reduce on an array of objects to sum their properties?
body: <p>Say I want to sum <code>a.x</code> for each element in <code>arr</code>.</p>
  <pre class="lang-js prettyprint-override"><code>arr = [ { x: 1 }, { x: 2 }, { x: 4 } ];
  arr.reduce(function(a, b){ return a.x + b.x; }); // =&gt; NaN
  </code></pre>
  <p>I have cause to believe that <code>a.x</code> is <code>undefined</code> at some point.</p>
  <p>The following works fine</p>
  <pre class="lang-js prettyprint-override"><code>arr = [ 1, 2, 4 ];
  arr.reduce(function(a, b){ return a + b; }); // =&gt; 7
  </code></pre>
  <p>What am I doing wrong in the first example?</p>