DNA pairing test

**Tell us what's happening:**
Describe your issue in detail here.
Hi guys i am trying to use switch statement on this challenge,is it possible??  if yes how do i go about it at this point??

      **Your code so far**
      
```js

function pairElement(str) {

switch (str) {
  case 0:
  pair = "A", "T";
  break;
  case 1: 
  pair = "T", "A";
  break;
  case 2:
  pair = "C", "G";
  break;
  case 3:
  pair = "G", "C";
}
return str;
}


console.log(pairElement("GCG"));
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0

Challenge: DNA Pairing

Link to the challenge:

This is throwing the entire long string into the switch. I think you’ll want to use a switch for each letter in the string instead.

This checks if str is strictly equal to 0, which will never happen. Same with all the other cases.

  • pair is not defined
  • I suppose you wanted to put those two values in an array a la ["A", "T"] but forgot the brackets?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.