title: Cluster two object arrays javascript
body: <p>I have two arrays</p>
  <pre class="lang-js prettyprint-override"><code>array1 = ['jan', 'mar', 'dec', 'jan', 'sep', 'nov', 'mar'];
  array2 = [3, 5, 5, 4, 5, 8, 2];
  </code></pre>
  <p>as seen, each month can appear more than once.</p>
  <p>id like to cluster/sort this data to have 2 arrays that show month and corresponding total values, in essence, get all the values that correspond to January, sum them and output them to another array, February should sum all February values and January values as well and so on. as well as a forth array containing months, without repeats. something like</p>
  <pre class="lang-js prettyprint-override"><code>array3 = ['jan', 'mar', 'sep', 'nov', 'dec'];
  array4 = [7, 14, 19, 24, 32]; //totals
  </code></pre>