forked from M3-Academy/challenge-algorithms-v2.0
feat(longestWords): laço com if condicional para verificação do length das palavras
This commit is contained in:
parent
4596cd6d58
commit
1acd1d9c07
@ -1,4 +1,11 @@
|
||||
export function longestWords(words) {
|
||||
// implementar logica aqui
|
||||
|
||||
}
|
||||
let longest = '';
|
||||
for (let word of words) {
|
||||
if (word.length > longest.length) {
|
||||
longest = word;
|
||||
}
|
||||
}
|
||||
|
||||
return words.filter((word) => word.length === longest.length);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user