title: Merge objects with same key in javascript
body: <p>I have been trying to figure this out for a long time, if i have an array of objects like so: </p>
  
  <pre><code>var my_array = [
      Object {Project: A, Hours: 2},
      Object {Project: B, Hours: 3},
      Object {Project: C, Hours: 5},
      Object {Project: A, Hours: 6},
      Object {Project: C, Hours: 9}
  ]
  </code></pre>
  
  <p>I want to merge all the objects with the same key together into one object, such that their hours get added up:</p>
  
  <p>Expected output:</p>
  
  <pre><code>my_array = [
      Object {Project: A, Hours: 8}
      Object {Project: B, Hours: 3}
      Object {Project: C, Hours: 14}
  ]
  </code></pre>
  
  <p>How can I approach this issue? It has taken me a long time to get my data formatted in this way, this is the last step!</p>
  
  <p>My attempt, I get that I am looping through array, not sure how to deal with the merging of the objects: </p>
  
  <pre><code>for (var i =0; i&lt;my_array.length; i++) {
     my_array[i].Project   // access the object project key
     my_array[i].Hours     // need to increment hours
  }
  </code></pre>