forked from M3-Academy/challenge-algorithms-v2.0
11 lines
291 B
JavaScript
11 lines
291 B
JavaScript
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);
|
|
}
|