Build an Email Masker - Build an Email Masker

Tell us what’s happening:

Am i missing the obvious answer? i tried every example email and every one works.

Your code so far

function maskEmail(email) {
  console.log(email.replace(email.slice(1,email.indexOf("@")-1),"*".repeat(email.indexOf("@")-2))); 
}
let email="freecodecamp@example.com";
maskEmail("freecodecamp@example.com");

Your browser information:

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

Challenge Information:

Build an Email Masker - Build an Email Masker

what is your function returning?

You need to return the result from the function instead of logging it inside the function. Then call console.log() when you invoke the function with the email argument.

2 Likes

it was returning f**********p@example.com

with what return statement?

it worked after changing the console.log to return in the function

thanks for trying to help

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