title: How to count number of occurrences of distinct values from an array of objects in Javascript?
body: <p>I have an array of objects like below:</p>
  
  <pre><code>var array =
      [
          {"name":"abc","age":20}
          {"name":"abc","age":20}
          {"name":"abc","age":20}
          {"name":"xyz","age":21}
          {"name":"xyz","age":21}
      ]
  </code></pre>
  
  <p>I want to count the number of occurrences of distinct values like:</p>
  
  <pre><code>[3,2]
  </code></pre>
  
  <p>Assuming <code>abc</code> has 3 occurrences and <code>xyz</code> has 2 occurrences.</p>
  
  <p>I am doing it in <code>reactjs</code>. I am able to get distinct values like <code>[abc,xyz]</code> using <a href="https://stackoverflow.com/questions/15125920/how-to-get-distinct-values-from-an-array-of-objects-in-javascript/35092559#35092559">this answer</a>.</p>
  
  <p><sub>ES6 syntax is preferred.</sub></p>