Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Clear category for [old] The Most Wanted Letter by juacompe
function mostWanted(text) {
let list = text.split("")
let frequent = {}
list.forEach(c => {
let lowerChr = c.toLowerCase()
frequent[lowerChr] = frequent[lowerChr] == undefined? 1: frequent[lowerChr]+1
})
let more = (a, b) => frequent[a] >= frequent[b]? a: b
let isLetter = (a) => /[a-z]/.test(a)
return Object.keys(frequent).filter(isLetter).sort().reduce(more)
}
May 16, 2019