18 lines
340 B
JavaScript
18 lines
340 B
JavaScript
export function longestWords(words) {
|
|
// implementar logica aqui
|
|
let big = "";
|
|
|
|
words.forEach(word => {
|
|
if(word.length > big.length){
|
|
big = word
|
|
}
|
|
});
|
|
|
|
const result = words.filter(word => {
|
|
if(word.length === big.length){
|
|
return word
|
|
}
|
|
});
|
|
|
|
return result
|
|
} |