Tell us what’s happening:
The code works fine, but it won’t accept is as valid, hence, not letting me continue. It also says that the returned value is wrong, even though is not.
Your code so far
const email = "apple.pie@example.com"
function maskEmail(email) {
const last = email.indexOf("@") - 1;
const initial = 1;
const sliced = email.slice(initial, last);
const masked = "*".repeat(sliced.length);
const final = email[0] + masked + email[last] + email.slice(last + 1);
console.log(final);
}
maskEmail(email);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36
Challenge Information:
Build an Email Masker - Build an Email Masker