feature/algoritmos #1

Merged
WellingtonDuarteSantos merged 10 commits from feature/algoritmos into master 2022-11-01 12:40:20 +00:00
Showing only changes of commit 56904fc642 - Show all commits

View File

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