Tell us what’s happening:
I have run the code, verified that I am getting the exact results that the test asks for, yet it will not verify the email addresses to pass me. It is outputting the correct amount of asterisks and displaying the emails correctly. I am not sure what is going wrong. Thank you for any help!
Your code so far
let email = "testing@email.com"
const maskEmail = (email) => {
let emailSymbol = "@";
let symbolIndex = email.indexOf(emailSymbol);
let firstLetter = email[0];
let maskedEmail = firstLetter + "*".repeat(symbolIndex - 2) + email[symbolIndex - 1] + email.slice(symbolIndex);
console.log(maskedEmail)
}
maskEmail("apple.pie@example.com");
maskEmail("freecodecamp@example.com");
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/134.0.0.0 Safari/537.36
Challenge Information:
Build an Email Masker - Build an Email Masker