I m getting the desired output but still unable to pass

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

let username = "Oceans11";
let userCheck;
console.log(username.length)
// let userCheck = /^[a-z]+[a-z]\d*$/ig; 
// let result = userCheck.test(username);
// console.log(result);
// console.log(username.match(userCheck));
if(username.length <= 2){
userCheck = /^[a-z]+[a-z]$/ig;
}
else{
userCheck = /^[a-z]+[a-z]*\d*$/ig;
}
let result = userCheck.test(username);
console.log(result);
console.log(username.match(userCheck));
  **Your browser information:**

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

Challenge: Restrict Possible Usernames

Link to the challenge:

the challenge only allows you to change one line, that of the regex. All conditions must be inserted in the regex body

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.