📅  最后修改于: 2022-03-11 15:02:41.929000             🧑  作者: Mango
function hideemail(target) {
var email = target //anas.behhari@gmail.com
var hiddenEmail = "";
for (i = 0; i < email.length; i++) {
if (i > 2 && i< email.indexOf("@") ) {
hiddenEmail += "*";
} else {
hiddenEmail += email[i];
}
}
console.log(hiddenEmail) //an.*******@gmail.com
}