console.log(protect_email("robin_singh@example.com"));
function protect_email(str)
{
var temp = str.split('')
var ar = [];
var ch ='...';
for(var i = 0 ; i< temp.length ; i++)
{
if(i>4 && i<12)
{
if(i==11)
{
ar[i]=ch;
ar.push(temp[i]);
}
}
else
{
ar.push(temp[i]);
}
}
return ar.join('')
}
To embed this program on your website, copy the following code and paste it into your website's HTML: