title: Combing Variables with Same Id
body: <p>I'm working on a project where i am trying to get array with all 50 US states. I have some data where the id is the abbreviated version of the state and some where the id is the name of the state. I want all of the data to be under an id that is equal to the name of the state.</p>
  <p>For this, I have:</p>
  <pre><code>let Array9 = (orderLocationUS);
      
   Array9.forEach((state) =&gt; {
              if (state._id === 'NY' || state._id === 'New York' || state._id === 'ny' || state._id === 'N.Y.' ){
                 state._id = 'New York'     
          }})
  console.log(orderLocationUS)
  </code></pre>
  <p><code>console.log(orderLocationUS) </code> gives:</p>
  <pre><code>[
    { _id: 'New York', count: 1, totalSales: 108.75 },
    { _id: 'New Jersey', count: 1, totalSales: 100 },
    { _id: 'New York', count: 31, totalSales: 627.93 }
  ]
  </code></pre>
  <p>I want the result:</p>
  <pre><code>[
    { _id: 'New Jersey', count: 1, totalSales: 100 },
    { _id: 'New York', count: 32, totalSales: 736.68 }
  ]
  </code></pre>
  <p>I tried to get the count by:</p>
  <pre><code>array10 = = orderLocationUS.filter((state) =&gt; state._id === 'New York').map(x =&gt; x.count).reduce((a, b) =&gt; a + b, 0)
  console.log(array10)
  </code></pre>
  <p>This does give me 32, but I need this in an array format and I know this is probably not the right way to get the results I need. I would really appreciate suggestion on how to get the:</p>
  <pre><code>[
    { _id: 'New Jersey', count: 1, totalSales: 100 },
    { _id: 'New York', count: 32, totalSales: 736.68 }
  ]
  </code></pre>
  <p>array that I need.</p>