forked from M3-Academy/challenge-algorithms-v2.0
feat: criação da resposta do 10-longestWords
This commit is contained in:
parent
614bead0f7
commit
9b60bfe028
@ -1,4 +1,17 @@
|
||||
export function longestWords(words) {
|
||||
// implementar logica aqui
|
||||
|
||||
|
||||
let loop = 0;
|
||||
let newWords = [];
|
||||
for (let index = 0; index < words.length; index++) {
|
||||
if (words[index].length > loop) {
|
||||
loop = words[index].length
|
||||
}
|
||||
}
|
||||
for (let index = 0; index < words.length; index++) {
|
||||
if (loop === words[index].length) {
|
||||
newWords.push(words[index])
|
||||
}
|
||||
}
|
||||
return newWords;
|
||||
}
|
Loading…
Reference in New Issue
Block a user