title: How to group objects by some property while summing another
body: <p>I try many ways to solve this. I can remove duplicate values. but the problem is updating total_product value. How can I do this? Give me some hints.</p>
  <h2>This is my Main Array :</h2>
  <pre><code> const colors = [
      { &quot;name&quot;: &quot;Black&quot;, &quot;total_product&quot;: 1 },
      { &quot;name&quot;: &quot;Black&quot;, &quot;total_product&quot;: 1 },
      { &quot;name&quot;: &quot;White&quot;, &quot;total_product&quot;: 1 },
      { &quot;name&quot;: &quot;White&quot;, &quot;total_product&quot;: 1 },
      { &quot;name&quot;: &quot;White&quot;, &quot;total_product&quot;: 1 },
      { &quot;name&quot;: &quot;White&quot;, &quot;total_product&quot;: 1 },    
  ]
  </code></pre>
  <h2>I Want Like This :</h2>
  <pre><code> const colors = [
      { &quot;name&quot;: &quot;Black&quot;, &quot;total_product&quot;: 2 },
      { &quot;name&quot;: &quot;White&quot;, &quot;total_product&quot;: 4 }         
  ]
  </code></pre>