challenge-algorithms-v2.0-n.../10-longestWords/index.js
2022-10-29 09:24:01 -03:00

14 lines
328 B
JavaScript

export function longestWords(words) {
// implementar logica aqui
let newArr = [];
let long = 0;
words.forEach(function(element){
if(element.length > long){
long = element.length
}
});
newArr = words.filter(element =>
element.length == long
);
return newArr;
}