Merge branch 'feature/longestwords' into development

This commit is contained in:
Marcello Rodrigues Martins 2022-10-31 18:29:35 -03:00
commit 5cfc0a0930

View File

@ -1,4 +1,12 @@
export function longestWords(words) { export function longestWords(words) {
// implementar logica aqui // implementar logica aqui
let lista = [];
words.forEach(palavra => {
if(!lista[0] || lista[0].length < palavra.length){
lista = [palavra]
} else if(lista[0].length == palavra.length){
lista.push(palavra)
}
});
return lista;
} }