Build an Email Masker - Build an Email Masker

Tell us what’s happening:

The code I have written works fine on node.js, which I launch on Window, but returns errors when launched on freecodecamp. Can you help me to find out the problem? Many thanks

Your code so far

let email = "freecodecamp@ecample.com";

function maskEmail(email) {
	let index = email.indexOf('@');
	let alpha = email.slice(1 , index - 1);
  let beta = '*'.repeat(alpha.length);
  return newEmail = email.replace(alpha , beta);
   
}


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 OPR/120.0.0.0

Challenge Information:

Build an Email Masker - Build an Email Masker

Where is this variable defined?

I have modified these lines of code:

let newEmail = email.replace(alpha , beta);
return newEmail;

Everything works except the step 10. I see no output but I can see it on node.js

Please post your updated code.

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

for test 10 you need to add a line of code that logs the output to the console