forked from M3-Academy/challenge-algorithms-v2.0
19 lines
471 B
JavaScript
19 lines
471 B
JavaScript
export function longestWords(words) {
|
|
// implementar logica aqui
|
|
let longWords = [];
|
|
let longLength = 0;
|
|
|
|
words.map(
|
|
(word) => {
|
|
if(word.length > longLength){
|
|
longLength = word.length;
|
|
longWords.splice(0, longWords.length);
|
|
longWords.push(word);
|
|
}
|
|
else if(word.length === longLength)
|
|
longWords.push(word);
|
|
}
|
|
);
|
|
|
|
return longWords;
|
|
} |