1function hideemail(target) {
2 var email = target //anas.behhari@gmail.com
3 var hiddenEmail = "";
4 for (i = 0; i < email.length; i++) {
5 if (i > 2 && i< email.indexOf("@") ) {
6 hiddenEmail += "*";
7 } else {
8 hiddenEmail += email[i];
9 }
10 }
11 console.log(hiddenEmail) //an.*******@gmail.com
12}