I don’t understand why this solution works for the challenge. Instead of using (?=\w{5,}) I was using (?=\w{6,}) because in the instructions it says the password string should only match if it is least six characters long.
Your code so far
let sampleWord = "astronaut";
let pwRegex = /^\D(?=\w{5,})(?=\w+\d{2})/; // Change this line
let result = pwRegex.test(sampleWord);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36.
both pass because there is no test for a string of length five, only of length six of above.
The challenge instructions could be interpreted both as “at least 5 characters”, or “at least 6 characters” by people.
There is not a test that specify which is the correct one.
you can open a bug for this if you want
Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.