My solution for removing consonants from a string works, but do you think there is a more Elegant way to solve this problem

besides writing all of the consonants out and assigning it to a regex variable. could I have an if/else statement that returns false if the regex is tested for vowels and returns true if its tested for consonants?

Here is my code:

Hello noblegas.

You could have one function that takes two arguments:
const myFunc = function(str, meth) { ... }
Where the second argument activates either removing vowels, or consonants.

In terms of the regex, you could use an if...else to change the regex from:
/[^aeiou]*/gi
to
/[aeiou]*/gi

Hope this helps