Select two characters that exists in the string c1,c2.Replace all occurrences of c1 with c2 and all occurrences of c2 with c1 for example. "bbcacad"
let s = "bbcacad"; let r; r = s.replace(new RegExp('b', "g"), '#'); r = r.replace(new RegExp('a', "g"), 'b'); r = r.replace(new RegExp('#', "g"), 'a'); console.log(s, r);
In above example :bbcacad That we can execute like aacbcbd And aabcbcd
I will try this