Tell us what’s happening:
My solution is correct but it is not passing the test.
Your code so far
const maskEmail = (email) => {
let hide = "*";
const textFinder = email.slice(0, ( email.indexOf("@") ));
const emailCheck = email.slice(email.indexOf("@"));
const showFirstandLast = textFinder.slice(1, ( email.indexOf("@") - 1));
const textToHide = textFinder.replace(showFirstandLast, hide.repeat(textFinder.length))
return textToHide + emailCheck;
}
let email = "apple.pie@example.com";
console.log(maskEmail(email));
email = "freecodecamp@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/131.0.0.0 Safari/537.36
Challenge Information:
Build an Email Masker - Build an Email Masker