how to find which string is repeated more in an array in javascript code example
Example 1: find duplicates and their count in an array javascript
var counts = {};
your_array.forEach(function(x) { counts[x] = (counts[x] || 0)+1; });
Example 2: javascript create array with repeated values
Array(5).fill(2)
//=> [2, 2, 2, 2, 2]