Tell us what’s happening:
I was able to pass this checkpoint with the code below. When I took a closer look, it doesn’t seem to make sense, is it a bug?
My initial thinking was that “?” would mean that any character (middle initial) following “Franklin” or “Eleanor” is optional. But in actuality, “?” only means that “Franklin” or “Eleanor” is optional. Not sure why this would allow me to pass since I would be leaving out keys parts of the name.
Your code so far
let myString = "Eleanor Roosevelt";
let myRegex = /(Franklin|Eleanor)? Roosevelt/; // Change this line
let result = myRegex.test(myString); // Change this line
// After passing the challenge experiment with myString and see how the grouping works
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
.
Challenge: Check For Mixed Grouping of Characters
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters