Merge pull request 'feat(longestWords): implementa funcao longestWords' (#10) from feature/longestWords into development

Reviewed-on: #10
This commit is contained in:
DaviKlein 2022-10-28 22:12:38 +00:00
commit d8e4ec0883

View File

@ -1,4 +1,13 @@
export function longestWords(words) { export function longestWords(words) {
// implementar logica aqui // implementar logica aqui
let maioresPalavras = [];
let auxiliar=words[0];
for(let i=0;i<words.length;i++){
if(auxiliar.length < words[i].length)
auxiliar = words[i]
}
for(let i=0;i<words.length;i++)
if(auxiliar.length == words[i].length)
maioresPalavras.push(words[i]);
return maioresPalavras;
} }