title: JavaScript Regular Expression Replace Multiple Letters
body: <p>I have the following code to replace a string of DNA with its complement where A &lt;=> T and C &lt;=> G. I do this with very basic knowledge of regular expressions. How can I refactor the following using regular expressions to capture the letter and replace it with its complement. </p>
  
  <pre><code>function DNA(strand) {
      return strand.replace(/A|T|C|G/g, x =&gt; {
          return (x=="A") ? "T" : (x=="T") ? "A" (x=="C") ? "G" : "C";
      });
  }
  </code></pre>