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

13 lines
280 B
JavaScript
Raw Permalink Normal View History

export function mostUsedChar(text) {
2022-11-02 21:21:59 +00:00
// implementar logica aqui
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;
}