title: how to replace email id text before @ with * in javascript?
body: <p>I am trying to resetting password in react Js. I need to display that email is sent to their email Id. I don't want to display their whole email instead I want to replace some characters with *.
  For example, someone has an email testing@gmail.com so I want to replace some random character with * ie tes***g@gmail.com.
  How could I do that in javascript??
  My code:</p>
  
  <pre><code>let a = testing@gmail.com
  let c = a.split('@');
  let b = c[0].slice(0,-3)+'***'+'@'+c[1];
  </code></pre>
  
  <p>but it is not efficient way.How to do efficiently??</p>
  
  <p>suppose if i have test@gmail.com then it should display t**t@gmail.com and if any@gmail.com it should be like a*y@gmail.com.</p>