Solución
solution.tsTypeScript
export function mostFrequentChar(text: string): string {
// Escribe tu solución aquí
const obj: Record<string, number> = {}
let currentMax = 0;
let currentLetter = ''
text.split('').forEach(l => {
if(!obj[l]) obj[l] = 0;
obj[l] = obj[l] + 1;
if(obj[l] > currentMax){
currentMax = obj[l];
currentLetter = l
}
})
return currentLetter;
}0respuestas