challenge-algorithms-v2.0-n.../10-longestWords/index.js

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
}