javascript count occurrences in array stored in objects code example
Example 1: javascript count number of occurrences in array of objects
var result = array.reduce( (acc, o) => (acc[o.name] = (acc[o.name] || 0)+1, acc), {} );
Example 2: javascript count number of occurrences in array of objects
var array =
[
{"name":"abc","age":20}
{"name":"abc","age":20}
{"name":"abc","age":20}
{"name":"xyz","age":21}
{"name":"xyz","age":21}
]