const arr = ["abc", "pqr", "abc", "xyz", "xyz"];
const frequency = arr.reduce((acc, item) => {
acc[item] = (acc[item] || 0) + 1;
return acc;
}, {});
console.log(frequency);
const arr = ["abc", "pqr", "abc", "xyz", "xyz"];
const frequency = arr.reduce((acc, item) => {
acc[item] = (acc[item] || 0) + 1;
return acc;
}, {});
console.log(frequency);
For further actions, you may consider blocking this person and/or reporting abuse
keploy -
swhabitation -
Mukul Aggarwal -
Mukul Aggarwal -
Top comments (0)