Regex question: My code works in console but doesn't pass tests

Tell us what’s happening:
I figured out by using the solution provided in the hints that my code didn’t work because I didn’t include let result =

But I still don’t understand why my code fails. It displays an array of all the vowels with no consonants when I console.log it. But the tests say “You should find all 25 vowels” and “Your regex should not match any consonants.” How does adding "let result = " solve those issues?

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
quoteSample.match(vowelRegex); // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36.

Challenge: Match Single Character with Multiple Possibilities

Link to the challenge:

Hello~!

let result = is assigning the value of your quoteSample.match(vowelRegex) to the variable result, which is necessary because the test checks for the value of result.

image

Thanks, I see now. The error messages just make it look like the code doesn’t do what it does.