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

14 lines
263 B
JavaScript
Raw Permalink Normal View History

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