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

9 lines
311 B
JavaScript

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