DNA pairing using if else loop..plz correct any mistakes

DNA pairing using if else loop..plz correct any mistakes
0.0 0

#1
function pairElement(str) {
  // Return each strand as an array of two elements, the original and the pair.
  var paired = [];

  // use if statement to check 
  var search = function(char) {
    if(char=='A')
    {
 paired.push(['A', 'T']);

    }
 else if(char=='T'){
     
  paired.push(['T', 'A']);
   }else if(char=='C'){
   
        paired.push(['C', 'G']);
       }
    else if  (char=='G'){
         paired.push(['G', 'C']);
       }
    };
  
  // Loops through the input and pair.
  for (var i = 0; i < str.length; i++) {
    search(str[i]);
  }

  return paired;
}
pairElement("CTCTA");

#2

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.