forked from M3-Academy/challenge-algorithms-v2.0
feat: finalizado mostRepeatedChar
This commit is contained in:
parent
302ca997f6
commit
b4852810c4
@ -1,4 +1,14 @@
|
||||
export function mostUsedChar(text) {
|
||||
// implementar logica aqui
|
||||
return ""
|
||||
let max = 0
|
||||
let maxChar = ''
|
||||
|
||||
text.split('').forEach((char) => {
|
||||
if(text.split(char).length > max) {
|
||||
max = text.split(char).length;
|
||||
maxChar = char;
|
||||
}
|
||||
});
|
||||
|
||||
return maxChar
|
||||
}
|
Loading…
Reference in New Issue
Block a user