Solución
solution.tsTypeScript
function groupByLength(words: string[]): Record<number, string[]> {
// Escribe tu solución aquí
const result = new Map<number, string[]>();
for(const word of words) {
result.set(word.length, [...result.get(word.length) || [], word])
}
return Object.fromEntries(result.entries());
}
// No modificar: necesario para evaluar el resultado.
export { groupByLength };0respuestas