Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Most Wanted Letter solution in Clear category for [old] The Most Wanted Letter by capback250
"use strict";
function mostWanted(data) {
var stringSize = data.length, letters = /[A-Za-z]/, hash = {}, max = 0, temp = [];
while (stringSize--){
if (letters.test(data[stringSize])) {
var currentLetter = data[stringSize].toLowerCase();
hash[currentLetter] ? hash[currentLetter]++ : hash[currentLetter] = 1;
temp.push(currentLetter)
}
}
Object.keys(hash).forEach(function (element) {
if (hash[element] > max) max = hash[element];
});
return temp.filter(function (element) {
return hash[element] >= max;
}).sort()[0];
}
Sept. 18, 2016