challenge-algorithms-v2.0-s.../09-mostRepeatedChar/index.js

15 lines
333 B
JavaScript
Raw Normal View History

export function mostUsedChar(text) {
// implementar logica aqui
text.trim().toLowerCase();
let bigger = 0;
let mostUsed = '';
for(const char of text){
if(text.split(char).length > bigger){
bigger = text.split(char).length;
mostUsed = char;
}
}
return mostUsed;
}