Tell us what’s happening:
Hello, i did this challenge but i really don’t get why the g flag is not correct here ? Can someone explain it to me ? thanks
Your code so far
let username = "JackOfAllTrades";
let userCheck = /^[a-z]{2,}\d*$/gi; // Change this line
let result = userCheck.test(username);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0.
I’m no wizard here but it seems necessary because you only want one string and you are specifying the beginning and end.
Why does it cause it to fail? Beats me. When I type those same things into a regex tester with your regex, they pass. But for whatever reason it doesn’t work. Maybe someone smarter than me can figure it out. But I agree that g is probably redundant here.