Solución
solution.tsTypeScript
function groupByFirstLetter(words: string[]): Record<string, string[]> {
const groups: Record<string, string[]> = {};
words.forEach(word => {
const firstLetter = word.charAt(0).toLowerCase();
if(!groups[firstLetter]) groups[firstLetter] = [];
groups[firstLetter].push(word);
})
return groups;
}
// No modificar: necesario para evaluar el resultado.
export { groupByFirstLetter };0respuestas