diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..134e01e 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,10 @@ export function longestWords(words) { - // implementar logica aqui - -} \ No newline at end of file + // 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); +}