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

13 lines
312 B
JavaScript
Raw Normal View History

export function longestWords(words) {
// implementar logica aqui
2022-11-02 13:27:30 +00:00
let maior = "";
for (const string of words) {
if (string.length > maior.length) {
maior = string;
}
}
2022-11-02 15:58:16 +00:00
const maiores = words.filter((string) => string.length == maior.length);
return maiores;
}