title: Convert string letters to different ones in JS
body: <p>I have this simple JS task that i can't figure out, not so simple for me after all.</p>
  <p>Create a function 'converter', that converts letters in this way:</p>
  <pre><code>T -&gt; C
  C -&gt; T
  A -&gt; D
  X -&gt; Y
  </code></pre>
  <p>Function accepts String with letters. All non convertable letters should be removed from string.</p>
  <p>Example:</p>
  <pre><code> - converter('TTCCAAXX') -&gt; 'CCTTDDYY'
   - converter('TTGG') -&gt; 'CC'
  </code></pre>
  <p>I tried something like this -</p>
  <pre><code>function Converter(str) {
  let upperStr = str.toUpperCase()
  let newStr = upperStr.replaceAll(&quot;T&quot;, &quot;C&quot;).replaceAll(&quot;C&quot;, &quot;T&quot;)
  console.log(newStr)
  }
  
  Converter(&quot;TTCCAAXX&quot;)
  </code></pre>
  <p>But this is replacing all the characters and overwriting them and I'm not getting the right results.</p>