Build an Email Masker - Build an Email Masker

Tell us what’s happening:

I don’t understand why it is not considered correct by the “code checker”. It does work!

Your code so far

function maskEmail(email){
  let arobasePosition = email.indexOf("@");
  let wordToSlice = email.slice(1, arobasePosition);
  let wordToSliceCharCount = wordToSlice.length - 1;
  let replacedChar = email.replace(wordToSlice, "*".repeat(wordToSliceCharCount));

  return replacedChar;
}

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

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0

Challenge Information:

Build an Email Masker - Build an Email Masker

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-email-masker/66b205e6eacba4c4e54ea434.md at main · freeCodeCamp/freeCodeCamp · GitHub

Welcome to the forum @Nuage1985,

If I test with myEmail@email.com from the instructions, your code returns m*****@email.com, but m*****l@email.com is expected. See the difference?

Happy coding

Oh !
I see it ^^
Thanks !