What is the problem in my code with case 9? It passes all the test except this one
Your code so far
function maskEmail(email){
let slicepoint = email.indexOf("@");
let mask = email.slice(0,slicepoint-1);
let leftover = email.slice(slicepoint-1,email.length);
let maskFchar = mask[0];
let regEx = /[a-z.]/g;
let masked = mask.replace(regEx,"*");
masked = masked.replace("*",maskFchar);
return masked + leftover;
}
let email = "apple.pie@example.com";
console.log(maskEmail(email));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36
Well i tried masking Apple.pie@example.com and with the previous version of my code the regex didnt detect capital chars. Ive now fixed the regex to include capital letters and managed to masked the address you sent me successfuly but I still get that error.
Well, I think I get where this is going. I fixed my regex pattern again and I’ve included some other special characters just in case,but still i cannot pass the test.
My regex looks like this now - let regEx = /[a-z.A-Z&$?;|]/g;