const email = "";
const username = email.substring(0, email.indexOf("@"));
const firstTwo = username.substring(0, 2);
const last = username.substring(username.length - 1);
const domainMail = email.substring(email.indexOf("@") + 1);

const emailMasked = firstTwo + "***" + last;

document.getElementById("emailMasked").textContent = "(" + emailMasked + "@" + domainMail + ")";