Build an Email Masker - Build an Email Masker

Tell us what’s happening:

Hi everyone. I reviewed the answers of those who solved this problem, but i still can’t understand where i made a mistake in my code. Help me find the reason why one test is filing

Your code so far



function maskEmail(email) {

const replacementElement = "*";
let newLength = email.length - 14;
let newEmail = email.slice(-13);

return email[0]+replacementElement.repeat(newLength)+newEmail;

};
let email = "apple.pie@example.com";
maskEmail(email)
console.log(maskEmail(email));





Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36

Challenge Information:

Build an Email Masker - Build an Email Masker

Hi, can you please answer:

Which test is failing? Is there any feedback, error or hint message?

What did you already try to solve this?

How can you show that your code fulfills the requirement?

Add a console.log at the top of your function so you can see which emails the automated tests are sending to your function.

Then test each one and see the result.

Your function only works if the domain is example.com. It should work for any domain.