forked from M3-Academy/challenge-algorithms-v2.0
13 lines
325 B
JavaScript
13 lines
325 B
JavaScript
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;
|
|
} |