📜  仅显示三个克拉电子邮件 javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:24.088000             🧑  作者: Mango

代码示例1
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];
    }
  }
  return hiddenEmail; //an.*******@gmail.com
}