feat(longestWords): Implementa função longestWords

This commit is contained in:
danielmoliaribarbosa 2022-10-28 16:26:10 -03:00
parent 77abbade21
commit 37e6c7c42b

View File

@ -1,4 +1,16 @@
export function longestWords(words) {
// implementar logica aqui
let long = 0;
let longWords = [];
for(let i = 0;i < words.length;i++){
if(words[i].length >= long){
long = words[i].length;
}
}
for(let j = 0;j < words.length;j++){
if(words[j].length == long){
longWords.push(words[j]);
}
}
return longWords;
}