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

10 lines
328 B
JavaScript

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