DNA Pairing Challenge

Tell us what’s happening:
Please, Can anyone explain me please what is the main purpose ? how to make these pairs ?

Your code so far

function pairElement(str) {
  return str;
}

pairElement("GCG");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/dna-pairing

IN DNA, A pair with T,G with C and vice-versa.
So, if input is "GCG"
you have to return an array [[“G”,“C”],[“C”,“G”],[“G”,“C”]]

To do it

Take a single character of the given string
and match it using any loop and if or switch case etc.
eg:-
for (loop until the given string length)
{
Take each character and check
If (this)
then
{this}

If (this)
then
{this}

    }

U can use switch in place of if …then
plus there are other ways to do it.
Try it first …if not will help with more.

1 Like

Thanks buddy it has work !