feat(longestWords): Implementa função longestWords
This commit is contained in:
parent
77abbade21
commit
37e6c7c42b
@ -1,4 +1,16 @@
|
||||
export function longestWords(words) {
|
||||
// implementar logica aqui
|
||||
|
||||
let long = 0;
|
||||
let longWords = [];
|
||||
for(let i = 0;i < words.length;i++){
|
||||
if(words[i].length >= long){
|
||||
long = words[i].length;
|
||||
}
|
||||
}
|
||||
for(let j = 0;j < words.length;j++){
|
||||
if(words[j].length == long){
|
||||
longWords.push(words[j]);
|
||||
}
|
||||
}
|
||||
return longWords;
|
||||
}
|
Loading…
Reference in New Issue
Block a user