JSFiddle - React, Tailwind, and code Playground
JavaScript
var arr = ['ab','pq','mn','ab','mn','ab'];
occurrences = arr.reduce(function(occ, item) {
occ[item] = (occ[item] || 0) + 1;
return occ;
}, {});
console.log(occurrences); // {ab: 3, pq: 1, mn: 2}
console.log(occurrences['mn']); // 2