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 [email protected] so I want to replace some random character with * ie tes***[email protected]. How could I do that in javascript?? My code:
let a = [email protected]
let c = a.split('@');
let b = c[0].slice(0,-3)+'***'+'@'+c[1];
but it is not efficient way.How to do efficiently??
suppose if i have [email protected] then it should display t**[email protected] and if [email protected] it should be like a*[email protected].