forked from M3-Academy/challenge-algorithms-v2.0
feat(10-longestWords): Cria a função
This commit is contained in:
parent
d2ea761b4f
commit
d11374eae2
@ -1,4 +1,10 @@
|
|||||||
export function longestWords(words) {
|
export function longestWords(words) {
|
||||||
// implementar logica aqui
|
let longWord = "";
|
||||||
|
let word;
|
||||||
|
for(word of words) {
|
||||||
|
if (word.length > longWord.length){
|
||||||
|
longWord = word;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return words.filter((word) => word.length === longWord.length);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user