forked from M3-Academy/challenge-algorithms-v2.0
feat(longestWords): adiciona resolucao questao10-longestwords
This commit is contained in:
parent
13f8ba9df7
commit
aec9c86d49
@ -1,4 +1,14 @@
|
||||
export function longestWords(words) {
|
||||
// implementar logica aqui
|
||||
|
||||
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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user