forked from M3-Academy/challenge-algorithms-v2.0
<refactor>(logestWrods): reorganização do código
This commit is contained in:
parent
a5ef9ec6a5
commit
54711a969e
@ -1,10 +1,9 @@
|
|||||||
export function longestWords(words) {
|
export function longestWords(words) {
|
||||||
// implementar logica aqui
|
// implementar logica aqui
|
||||||
let longestSize = 0
|
let longestSize = 0
|
||||||
let longestWord = []
|
|
||||||
words.forEach(element => {
|
words.forEach(element => {
|
||||||
if(element.length>longestSize){
|
if(element.length>longestSize){
|
||||||
longestSize = element.length}})
|
longestSize = element.length}})
|
||||||
longestWord = words.filter(element => element.length === longestSize);
|
let longestWord = words.filter(element => element.length === longestSize);
|
||||||
return longestWord
|
return longestWord
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user