javascript count duplicates in string code example
Example: counting duplicate values 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; });