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

13 lines
325 B
JavaScript
Raw Normal View History

export function longestWords(words) {
// implementar logica aqui
let arr = [''];
for(let i = 0; i < words.length; i++){
if(words[i].length > arr[0].length){
arr = [words[i]];
}else if(words[i].length == arr[0].length){
arr.push(words[i]);
}
}
return arr;
}