I have an array of objects like below:
var array =
    [
        {"name":"abc","age":20}
        {"name":"abc","age":20}
        {"name":"abc","age":20}
        {"name":"xyz","age":21}
        {"name":"xyz","age":21}
    ]
I want to count the number of occurrences of distinct values like:
[3,2]
Assuming abc has 3 occurrences and xyz has 2 occurrences.
I am doing it in reactjs. I am able to get distinct values like [abc,xyz] using this answer.
ES6 syntax is preferred.
 
     
     
     
     
     
     
    