forked from M3-Academy/challenge-algorithms-v2.0
feat(longestWords): funcao feita
This commit is contained in:
parent
74a08c52c7
commit
447575f0be
@ -1,4 +1,12 @@
|
|||||||
export function longestWords(words) {
|
export function longestWords(words) {
|
||||||
// implementar logica aqui
|
// 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