forked from M3-Academy/challenge-algorithms-v2.0
merge all challenges #1
@ -1,4 +1,9 @@
|
||||
export function longestWords(words) {
|
||||
// implementar logica aqui
|
||||
|
||||
return words.reduce((longWords, currentWord) => {
|
||||
if(!longWords[0] || longWords[0].length < currentWord.length) return [currentWord];
|
||||
if(longWords[0].length > currentWord.length) return longWords;
|
||||
longWords.push(currentWord);
|
||||
return longWords;
|
||||
},[])
|
||||
}
|
Loading…
Reference in New Issue
Block a user