I need to convert all the G’s into C’s and C’s to G’s. Can someone help me find a way to stop the G and C from contradicting themselves? What I have so far:(I am beginner level at coding)
var str = "ATGC";
var step1 = (str.replace (/A/g, 'U'));
var step2 = (step1.replace (/T/g, 'A'));
var step3 = (step2.replace (/C/g, 'G'));
var step4 = (step3.replace (/G/g, 'C'));
var convertedStr = step4;
console.log(convertedStr);
End result is UACC
because the step3 changes the C’s to a G and then step4 changes both new G’s into C’s