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

14 lines
328 B
JavaScript
Raw Normal View History

export function longestWords(words) {
// implementar logica aqui
2022-10-29 12:24:01 +00:00
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;
}