2022-10-27 15:07:13 +00:00
|
|
|
export function longestWords(words) {
|
|
|
|
// implementar logica aqui
|
2022-10-28 13:51:39 +00:00
|
|
|
let big = "";
|
2022-10-27 15:07:13 +00:00
|
|
|
|
2022-10-28 13:51:39 +00:00
|
|
|
words.forEach(word => {
|
|
|
|
if(word.length > big.length){
|
|
|
|
big = word
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const result = words.filter(word => {
|
|
|
|
if(word.length === big.length){
|
|
|
|
return word
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return result
|
2022-10-27 15:07:13 +00:00
|
|
|
}
|