Build an Email Masker - Build an Email Masker

Tell us what’s happening:

I’ve run multiple test to pass this assignment but nothing works. My results were exactly what were needed.

function maskEmail(email){
  let indexer = (email.indexOf('@')-1);
  let slicer = email.slice(1,indexer);
  let hide = '*';
  let replaced = email.replace(slicer,hide.repeat(indexer));
  return(replaced)
}

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

email = "freecodecamp@example.com";
console.log(maskEmail(email));```

### Your code so far


```js
function maskEmail(email){
  let indexer = (email.indexOf('@')-1);
  let slicer = email.slice(1,indexer);
  let hide = '*';
  let replaced = email.replace(slicer,hide.repeat(indexer));
  return(replaced)
}

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

email = "freecodecamp@example.com";
console.log(maskEmail(email));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:136.0) Gecko/20100101 Firefox/136.0

Challenge Information:

Build an Email Masker - Build an Email Masker

Welcome to the forum @dannylatwales2

Compare the expected output with the actual output.
Are they both the same length?

Happy coding

Thanks, for the welcome!

I have compared the outputs and they are exactly the same.

Here's the code again

function maskEmail(email){
  let indexer = (email.indexOf('@')-1);
  let slicer = email.slice(1,indexer);
  let hide = '*';
  let replaced = email.replace(slicer,hide.repeat(indexer));
  return replaced
}

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

email = “freecodecamp@example.com”;
console.log(maskEmail(email));

Wait, don't worry about answering the other question, I've solved it

Thanks for the advice