title: How to Reduce An Array of Objects That Contain Matching Keys/Values + Variations?
body: <p>What is the best way to reduce this array of objects to get the desired result?</p>
  <pre><code>const arr = [
    {
            &quot;id&quot;: &quot;561&quot;,
            &quot;count&quot;: &quot;1&quot;,
            &quot;month&quot;: 7
        },
        {
            &quot;id&quot;: &quot;561&quot;,
            &quot;count&quot;: &quot;1&quot;,
            &quot;month&quot;: 7
        },
        {
            &quot;id&quot;: &quot;561&quot;,
            &quot;count&quot;: &quot;-1&quot;,
            &quot;month&quot;: 8
        },
        {
            &quot;id&quot;: &quot;561&quot;,
            &quot;count&quot;: &quot;1&quot;,
            &quot;month&quot;: 9
        },
        {
            &quot;id&quot;: &quot;561&quot;,
            &quot;count&quot;: &quot;-1&quot;,
            &quot;month&quot;: 9
        }
    ]
  </code></pre>
  <p>As you can see the id matches and some of the months match. What I would like to achieve is something along the lines of:</p>
  <pre><code>[
    {
      &quot;id&quot;: &quot;561&quot;,
      &quot;count&quot;: 2
      &quot;month&quot;: 7
    },
    {
      &quot;id&quot;: &quot;561&quot;,
      &quot;count&quot;: -1,
      &quot;month&quot;: 8
    },
    {
      &quot;id&quot;: &quot;561&quot;,
      &quot;count&quot;: 0,
      &quot;month&quot;: 9
    }
  ]
  </code></pre>
  <p>I'm basically trying to get the total count by month per id.</p>