forked from M3-Academy/challenge-algorithms-v2.0
10 lines
259 B
JavaScript
10 lines
259 B
JavaScript
export function longestWords(words) {
|
|
let longWord = "";
|
|
let word;
|
|
for(word of words) {
|
|
if (word.length > longWord.length){
|
|
longWord = word;
|
|
}
|
|
}
|
|
return words.filter((word) => word.length === longWord.length);
|
|
} |