📅  最后修改于: 2022-03-11 14:59:47.094000             🧑  作者: 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
}