Build an Email Masker - Build an Email Masker

Tell us what’s happening:

My code runs as I expected, but tests 3, 4, and 10 do not pass.

Your code so far

function maskEmail(email) {
let findAtSymbol = email.indexOf("@");
let username = email.slice(1, findAtSymbol-1);
let domain = email.slice(findAtSymbol);
let mask = "*";
let maskedEmail = email.replace(username, mask.repeat(username.length));
return maskedEmail;
}

console.log(maskEmail("example@email.com"))

Your browser information:

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

Challenge Information:

Build an Email Masker - Build an Email Masker
https://www.freecodecamp.org/learn/full-stack-developer/lab-email-masker/build-an-email-masker

All of those tests have something in common, and you’ll feel silly when you figure out what it is because you’re basically already doing it.