DNA Pairing(help)

DNA Pairing(help)
0.0 0


Hey, guys, can anyone help me out on this? I am not sure what I am I doing wrong as i cannot pass the tests.

var pair_1 = ["A","T"];
var pair_1_reverse = ["T","A"];
var pair_2 = ["C","G"];
var pair_2_reverse = ["G","C"];
var result = [];
function pairElement(str) {
  str = str.split("");
  var i ;
  for(i = 0;i < str.length;i++){
     if(str[i] === "A" ){
     else if(str[i] === "T"){
     else if(str[i] === "C"){
  return result;


Thanks in advance for your help!


Move this variable declaration inside the pairElement function. Because it is globally declared and the FCC tests make consecutive calls to the function, result does not get reset to an empty array at the start of each function call.


Of course. Spot on! I will be on the lookout for mistakes like that.