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

13 lines
312 B
JavaScript
Raw Normal View History

export function longestWords(words) {
// implementar logica aqui
let maior = "";
for (const string of words) {
if (string.length > maior.length) {
maior = string;
}
}
const maiores = words.filter((string) => string.length === maior.length);
return maiores;
}