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