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

13 lines
295 B
JavaScript
Raw Normal View History

export function longestWords(words) {
// implementar logica aqui
2022-10-31 19:52:38 +00:00
return words.reduce((r, s, i) => {
if (!i || r[0].length < s.length) {
return [s];
}
if (r[0].length === s.length) {
r.push(s);
}
return r;
}, []);
}