Solución
solution.tsTypeScript
function groupByLength(words: string[]): Record<number, string[]> {
// Escribe tu solución aquí
const someObj = {}
if( words.length < 1 ) return {}
for ( const word of words ) {
if ( word.length in someObj ) {
someObj[word.length].push( word )
continue
}
someObj[Number(word.length)] = [ word ]
}
return someObj;
}
// No modificar: necesario para evaluar el resultado.
export { groupByLength };0respuestas