feat: criação da resposta do 10-longestWords

This commit is contained in:
Matheus Mariosa 2022-11-02 13:32:48 -03:00
parent 614bead0f7
commit 9b60bfe028

View File

@ -1,4 +1,17 @@
export function longestWords(words) {
// implementar logica aqui
let loop = 0;
let newWords = [];
for (let index = 0; index < words.length; index++) {
if (words[index].length > loop) {
loop = words[index].length
}
}
for (let index = 0; index < words.length; index++) {
if (loop === words[index].length) {
newWords.push(words[index])
}
}
return newWords;
}