Tell us what’s happening:
So I dont understand why the tests arent passing? When I console.log everything im getting the result that the test is asking for, which is the asterisks hiding the name except for the 0 index and the index before the ampersand. All I could think of is maybe the test wants to also have the quotations included
Your code so far
let email = "apple.pie@example.com";
function maskEmail(email){
let star = "*";
let emailNameSearch = email.indexOf("@");
let maskedEmail = email.slice(1, emailNameSearch)
let privateName = maskedEmail.replace(/./g, star);
let reconstructedEmail = email.slice(0,1) + privateName + email.slice(emailNameSearch - 1);
return reconstructedEmail;
}
console.log(maskEmail("apple.pie@example.com"));
console.log(maskEmail("info@test.dev"));
console.log(maskEmail("user@domain.org"));
console.log(maskEmail(email));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36
Challenge Information:
Build an Email Masker - Build an Email Masker