Build an Email Masker - Build an Email Masker

Tell us what’s happening:

Hi Guys, the number 4 instruction is not working , you should assign a valid email address top email variable how can I solve it

Your code so far

function maskEmail(email){
 let indexOf = email.indexOf("@");
 let localPart = email.slice(0, indexOf);
 let domainpart = email.slice(indexOf);
 let maskedLocalPart =  localPart[0] + "*".repeat(localPart.length - 2) + localPart[localPart.length - 1];
 return maskedLocalPart + domainpart;
}

let email = maskEmail("freecodecamp@example.com");
email = maskEmail("apple.pie@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/134.0.0.0 Safari/537.36

Challenge Information:

Build an Email Masker - Build an Email Masker

Hi there and welcome to our community!

Your issue is in these lines here:

You should not be assigning the function call to the email variable, only a string with a valid email address.

Thanks for the help!