DNA Pairing

The DNA pairing was straight and forward and the example we were given, gave a me a exactly what is needed I first wanted to use a for-loop then I got stuck didnt know where to go from using a for-loop but then I recalled that I can also use a case statement which I once did on freecodecamp.

Promble

The DNA strand is missing the pairing element. Take each character, get its pair, and return the results as a 2d array.

Return the provided character as the first element in each array. For example, for the input GCG, return [[“G”, “C”], [“C”,”G”],[“G”, “C”]].

My solution

I have an empty array which will be our new array, then I used a case statement of characters that has to follow each other accordingly and I have a for-loop which will iterate through after the case statement break and have another array inside the array.

Experience

It was good for me because I could understand what was needed from me and which route to take from then. To also recall what I have learned and now I am applying it, it absolute became a great learnign curve to me.