feat(10-longestWords):completead tenth challenge

This commit is contained in:
Marcello Rodrigues Martins 2022-10-31 18:28:35 -03:00
parent c6f6df9c59
commit 146c2a9cc3

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;
} }