title: How to Iterate through a grouped object in JavaScript
body: <p>I have an array of grouped objects, but I'm unable to iterate through and achieve the desired result.</p>
  <pre><code>[ 000000010: [
    {
      &quot;userId&quot; : &quot;000000010&quot;,
      &quot;played&quot; : 10,
      &quot;lost&quot; : 5,
      &quot;date&quot; :&quot;2019-04-01T00:00:00.000Z&quot; 
      },
    {
      &quot;userId&quot; : &quot;000000010&quot;,
      &quot;played&quot;: 15,
      &quot;lost&quot; : 0,
      &quot;date&quot; :&quot;2019-04-02T00:00:00.000Z&quot; 
      }, 
  ],
  000000020: [
    {
      &quot;userId&quot; : &quot;000000020&quot;,
      &quot;played&quot;: 11,
      &quot;lost&quot; : 4,
      &quot;date&quot; :&quot;2019-04-01T00:00:00.000Z&quot; 
      },
    {
      &quot;userId&quot; : &quot;000000020&quot;,
      &quot;played&quot;: 15,
      &quot;lost&quot; : 0,
      &quot;date&quot; :&quot;2019-04-02T00:00:00.000Z&quot; 
      }, 
  ]
  
  ]
  </code></pre>
  <p>I want to eliminate all possible duplicates and group all similar objects as follows</p>
  <pre><code>    {
      &quot;userId&quot; : &quot;000000010&quot;,
      &quot;played&quot;: 30,
      &quot;lost&quot; : 5,
      },
    {
      &quot;userId&quot; : &quot;000000020&quot;,
      &quot;played&quot;: 26,
      &quot;lost&quot; : 6,
      }, 
  </code></pre>
  <p>I have tried</p>
  <pre><code>Object.entries() 
  </code></pre>
  <p>but it returned</p>
  <pre><code>[obeject: object]
  </code></pre>
  <p>I have also tried</p>
  <pre><code>const allResults = {}
  Object.keys(result).forEach(function(key) {
      let chats = result[key].chats;
            allResults[chats] = allResults[chats] ? allResults[chats] + 1 : 1;
    });
  </code></pre>
  <p>But I get undefined</p>