Zeigen Sie nur drei Karaters -E -Mail -JavaScript an

function hideemail(target) {
  var email = target //[email protected]
  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
}