Build an Email Masker - Build an Email Masker

Tell us what’s happening:

the output is ok, but i don’t pass the challenge
function maskEmail(email){
let a = email.slice(1, -13)
let b = “*”
let rep = b.repeat(a.length);
let repla = email.replace(a, rep);
return repla
}
let email = “apple.pie@example.com
let email2= “freecodecamp@example.com
console.log(maskEmail(email))
console.log(maskEmail(email2))

Your code so far

the output is ok, but dont work 
function maskEmail(email){
  let a = email.slice(1, -13)
  let b = "*"
  let rep = b.repeat(a.length);
  let repla = email.replace(a, rep);
  return repla 
}
let email = "apple.pie@example.com"
let email2= "freecodecamp@example.com"
console.log(maskEmail(email))
console.log(maskEmail(email2))


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36

Challenge Information:

Build an Email Masker - Build an Email Masker

I don’t think that matches the sample output though? Shouldn’t you have an @ in the output?

Also, I recommend using the full words as variable names. It helps others understand your code (or you in the future).

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.