diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..9f6b477 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,16 @@ export function longestWords(words) { // implementar logica aqui - + let maior = 0; + let maioresPalavras = []; + for(let i = 0;i < words.length;i++){ + if(words[i].length >= maior){ + maior = words[i].length; + } + } + for(let j = 0;j < words.length;j++){ + if(words[j].length == maior){ + maioresPalavras.push(words[j]); + } + } + return maioresPalavras; } \ No newline at end of file