const counts = {}; your_array.forEach(function(x.name) { counts[x.name] = (counts[x.name] || 0)+1; });