forked from M3-Academy/challenge-algorithms-v2.0
desafio 10 concluido
This commit is contained in:
parent
70fd2a1c47
commit
e4062844a5
@ -1,4 +1,10 @@
|
||||
export function longestWords(words) {
|
||||
// implementar logica aqui
|
||||
|
||||
let maiorPalavra = "";
|
||||
for (let i = 0; i < words.length; i++) {
|
||||
if (words[i].length > maiorPalavra.length) {
|
||||
maiorPalavra = words[i];
|
||||
}
|
||||
}
|
||||
return words.filter((i) => i.length === maiorPalavra.length);
|
||||
}
|
Loading…
Reference in New Issue
Block a user