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

13 lines
335 B
JavaScript
Raw Normal View History

export function mostUsedChar(text) {
// implementar logica aqui
2022-11-02 13:14:07 +00:00
let max = 0;
let mostRep = '';
text.split('').forEach(function (index) {
if (text.split(index).length > max ) {
max = text.split(index).length;
mostRep = index;
}
}
);
return mostRep;
}