skip to Main Content

Replacing letters in a string using javaScript

function dnaStrand(dna){ const compl = dna; dna.includes("A") && compl.replace(/A/g, "T"); dna.includes("T") && compl.replace(/T/g, "A") dna.includes("C") && compl.replace(/C/g, "G") dna.includes("G") && compl.replace(/G/g, "C") console.log(compl) return compl } I intend to form the complementary dna strand, that is, A is complementary to…

VIEW QUESTION
Back To Top
Search