Build an Email Masker - Build an Email Masker

Tell us what’s happening:

I am stuck how do I go about masking the email and appending the domain.

Your code so far

function maskEmail(email){
email.slice()

}

const email = 'apple.pie@example.com';
console.log(maskEmail(email));

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36

Challenge Information:

Build an Email Masker - Build an Email Masker

1 Like

Hi there and welcome to our community!

Have you completed the course materials which come before this project? Methods like slice (and other string manipulation methods) are covered in detail in earlier lessons.

What are you struggling with exactly?

There’s a lot you can do with your code. Lemme give you a hint.

1 - find a word that can separate the domain name or username which is “@” using “IndexOf”
2 - then with the use of “slice” extract both.
3 - create a variable and mask the username with the asterisk sign(*), use the concatenation method.
make sure to first word or last domain is visible.
4 - return the masked variable.

Your outer function is correct.
Happy Coding.

3 Likes

This was so helpful. Thank you! I feel like they didn’t do a great job at working with string manipulation before introducing this project. I relied mostly on template liberals and the repeat function for this, in case anyone needs any additional hints :slight_smile:

4 Likes
> Code removed by moderator

hi @a.k.piintu

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge. How to Help Someone with Their Code Using the Socratic Method

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

2 Likes