title: How to sum all of values from specific key in object?
body: <p>Let's say I have a array that contains a multiple object like:</p>
  
  <pre><code>var arr = [{ 'credit': 1, 'trash': null }, { 'credit': 2, 'trash': null}]
  </code></pre>
  
  <p>I want to get a sum of all <code>credit</code> value from <code>arr</code> array. so expected sum value is 3. so I used this code: </p>
  
  <p><code>arr.reduce((obj, total) =&gt; obj.credit + total)</code></p>
  
  <p>but when I run this, I get <code>"1[object Object]"</code> which is really weird.</p>
  
  <p>Ps: I'm trying to implement this using ES6 not ES5</p>