feat: Soluciona o exercício 10
This commit is contained in:
parent
32e2c086e3
commit
9b3ac56a7c
@ -1,4 +1,19 @@
|
|||||||
export function longestWords(words) {
|
export function longestWords(words) {
|
||||||
// implementar logica aqui
|
// implementar logica aqui
|
||||||
|
|
||||||
|
let longestWord = ''
|
||||||
|
|
||||||
|
words.forEach((word) => {
|
||||||
|
if(word.length > longestWord.length){
|
||||||
|
longestWord = word
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const longestWords = words.filter((word) => {
|
||||||
|
if(word.length === longestWord.length){
|
||||||
|
return word
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return longestWords
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user