forked from M3-Academy/challenge-algorithms-v2.0
Merge branch 'feature/10-longestWords' into developer
This commit is contained in:
commit
dd43ee9294
@ -1,4 +1,17 @@
|
|||||||
export function longestWords(words) {
|
export function longestWords(words) {
|
||||||
// implementar logica aqui
|
// 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