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
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.