13 lines
295 B
JavaScript
13 lines
295 B
JavaScript
export function longestWords(words) {
|
|
// implementar logica aqui
|
|
|
|
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;
|
|
}, []);
|
|
} |