forked from M3-Academy/challenge-algorithms-v2.0
feat(longestWords): funcao feita #10
@ -1,4 +1,12 @@
|
||||
export function longestWords(words) {
|
||||
// implementar logica aqui
|
||||
|
||||
let numeroDeCaractere = 0
|
||||
|
||||
words.forEach((word) => {
|
||||
if (word.length >= numeroDeCaractere) {
|
||||
numeroDeCaractere = word.length
|
||||
}
|
||||
})
|
||||
|
||||
return words.filter((palavra) => (palavra.length == numeroDeCaractere))
|
||||
}
|
Loading…
Reference in New Issue
Block a user