diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..99146ea 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,13 @@ export function longestWords(words) { - // implementar logica aqui - + + let sortedWords = words.sort((a, b) => b.length - a.length); + let maxLength = sortedWords[0].length + let longestWords = [] + + for (let word of sortedWords) { + if(word.length != maxLength) break; + longestWords.push(word) + } + + return longestWords; } \ No newline at end of file