Tell Us What’s Happening So Far:
I’ve coded a simple for…loop with if statements to handle the DNA pairing problem:
Your Code So Far:
function pairElement(str){
let dNa=[];
for(let i=0;i<str.length;i++){
if(str[i]==='A'){dNa[i]=['A','T'];}
if(str[i]==='T'){dNa[i]=['T','A'];}
if(str[i]==='G'){dNa[i]=['G','C'];}
if(str[i]==='C'){dNa[i]=['C','G'];}
}
return dNa;
}
Even though the output appears correct, FCC wont accept this solution. Can anyone tell me what I’m doing wrong?