Solución
solution.tsTypeScript
function groupByFirstLetter(words: string[]): Record<string, string[]> {
let obj:Record<string,string[]> = {};
for(let i = 0; i < words.length; i++) {
let firstLetter = words[i][0].toLowerCase();
let arr = [];
if(!obj[firstLetter]) {
arr.push(words[i]);
obj[firstLetter] = arr;
} else {
obj[firstLetter].push(words[i])
}
}
return obj;
}
// No modificar: necesario para evaluar el resultado.
export { groupByFirstLetter };0respuestas