27 lines
449 B
JavaScript
27 lines
449 B
JavaScript
export function longestWords(words) {
|
|
// implementar logica aqui
|
|
|
|
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;
|
|
}
|
|
|
|
|
|
|