feat(longestwords):aplicando a função ao teste 10

This commit is contained in:
Gabriel Bernardini 2022-10-29 13:03:15 -03:00
parent 6b964afa76
commit 6164b52cf0

View File

@ -1,4 +1,18 @@
export function longestWords(words) {
// implementar logica aqui
let bigword = "";
words.forEach(word => {
if(word.length > bigword.length){
bigword = word
}
});
const finalword = words.filter(word => {
if(word.length === bigword.length){
return word
}
});
return finalword
}