feat(longestWords): laço com if condicional para verificação do length das palavras

This commit is contained in:
Ramon Dias Ferreira 2022-11-02 15:16:08 -03:00
parent 4596cd6d58
commit 1acd1d9c07

View File

@ -1,4 +1,11 @@
export function longestWords(words) {
// implementar logica aqui
}
let longest = '';
for (let word of words) {
if (word.length > longest.length) {
longest = word;
}
}
return words.filter((word) => word.length === longest.length);
}