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

20 lines
364 B
JavaScript

export function longestWords(words) {
// implementar logica aqui
let long = ''
const longest = words.map((word) => {
if(word.length > long.length) {
long = word;
}
return word
}).filter((word) => {
if(word.length === long.length) {
return word;
}
});
return longest
}