forked from M3-Academy/challenge-algorithms-v2.0
feat(10-longestWords):completead tenth challenge
This commit is contained in:
parent
c6f6df9c59
commit
146c2a9cc3
@ -1,4 +1,12 @@
|
||||
export function longestWords(words) {
|
||||
// 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user