Tell us what’s happening:
What could I be doing wrong. I event tried to initialize the variables out of the function all I could get was the same email adress.
Your code so far
let email = "barrybrian11@gmail.com";
function maskEmail(email){
let maskedPart = email.slice(1,email.indexOf("@")-1);
let hide = "*".repeat(maskedPart.length);
let replaced=email.replace(`${maskedPart}`,`${hide}`);
return replaced
}
console.log(maskEmail());
console.log(maskEmail("apple.pie@example.com"));
console.log(maskEmail("f**********p@example.com"));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Challenge Information:
Build an Email Masker - Build an Email Masker