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

12 lines
311 B
JavaScript

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