So, I just completed this challenge. On my first run through I did:
let vowelRegex = /[a|e|i|o|u]/gi;
Then I thought to see if this would work (both examples pass the challenge):
let vowelRegex = /[aeiou]/gi;
Is there a reason to use the OR operator like my first example when extracting single characters from a string? Would leaving the OR operator(s) out of it be considered best practice in this case since doing so achieves the same results using less code?
Thank you!
Your code so far
let quoteSample = "Beware of bugs in the above code; I have only proved it correct, not tried it.";
let vowelRegex = /[aeiou]/ig; // Change this line
let result = quoteSample.match(vowelRegex); // Change this line
console.log(result);
Challenge: Match Single Character with Multiple Possibilities
Link to the challenge: