8 lines
317 B
JavaScript
8 lines
317 B
JavaScript
export function mostUsedChar(text) {
|
|
// implementar logica aqui
|
|
const charHolder = text.toLowerCase().split('').reduce((ac,a) => (ac[a] = ac[a] + 1 || 1, ac), {});
|
|
|
|
let max = Math.max(...Object.values(charHolder));
|
|
|
|
return Object.entries(charHolder).reduce((ac,[k,v]) =>v === max ? ac + k : ac, '');
|
|
} |