re: Daily Challenge #80 - Longest Vowel Change VIEW POST

FULL DISCUSSION
 

Javascript version

longestVowelList = (str) => {
  const vowels = ["a", "e", "i", "o", "u"];
  const result = vowels.map(vowel => {
    const regex = new RegExp(`[^${vowel}]+`);
    return str.split(regex)
       .filter(r => r !== "")
       .sort((a, b) => b.length - a.length);
  });
  return result.flat(1).join("");
}
console.log('---->',longestVowelList("codewarriors"));
//Output ----> aeioo
code of conduct - report abuse