Closed RazvanBugoi closed 4 years ago
function mostFrequentItemCount(collection) {
let obj = {};
if (collection.length > 0 ) {
collection.map((el) => el in obj ? obj[el] += 1 : obj[el] = 1);
} else return 0;
return Math.max(...Object.values(obj));
}
https://www.codewars.com/kata/56582133c932d8239900002e/train/javascript