2022-10-27 15:07:13 +00:00
|
|
|
export function longestWords(words) {
|
|
|
|
// implementar logica aqui
|
2022-10-31 19:55:29 +00:00
|
|
|
|
|
|
|
let longestLength = 0;
|
|
|
|
let longestWords = [];
|
|
|
|
|
|
|
|
words.forEach(word => {
|
|
|
|
if (longestLength < word.length) {
|
|
|
|
longestLength = word.length;
|
|
|
|
} else {
|
|
|
|
longestLength;
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
words.forEach(word => {
|
|
|
|
if (word.length === longestLength) {
|
|
|
|
longestWords.push(word);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return longestWords;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|