const mostFrequent = arr => Object.entries( arr.reduce((a, v) => { a[v] = a[v] ? a[v] + 1 : 1; return a; }, {}) ).reduce((a, v) => (v[1] >= a[1] ? v : a), [null, 0])[0];