Build an Email Masker - Build an Email Masker

Tell us what’s happening:

The results that are desired are there, but I m not passing instruction 4.

Instruction 4
Assign as valid email address to email variable.

I tried assigning different emails but it not passing.What am I foing wrong?

Your code so far

function maskEmail(email){
  const maskLength = email.slice(1 , email.indexOf("@")-1);
 const exchangeChar = "*";
 const  eCharLength = maskLength.replace(maskLength, exchangeChar.repeat(maskLength.length)) ;
 const replaceChara = email.replace(maskLength , eCharLength );
  return replaceChara };
maskEmail("test@lab.com")
const email = "test@lab.com ";
console.log(maskEmail(email))

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36

Challenge Information:

Build an Email Masker - Build an Email Masker

Your function works as expected. But the tests don’t like the space at the end of your email assignment. And if you try to reassign email, you will get an error because you’ve declared it with const rather than let.

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