count number of the same elements in an array javascript code example
Example: find duplicates and their count in an array javascript
var counts = {};
your_array.forEach(function(x) { counts[x] = (counts[x] || 0)+1; });
var counts = {};
your_array.forEach(function(x) { counts[x] = (counts[x] || 0)+1; });