Hi guys, I don’t know what’s going on with my code. I seem to return the right thing but it doesn’t pass the challange.
function pairElement(str) {
var array = [];
var singleElement = str.split("");
singleElement.forEach(function(dna){
var temporaryArray = [];
if(dna == "G"){
temporaryArray.push("G");
temporaryArray.push("C");
array.push(temporaryArray);
} else if(dna == "C"){
temporaryArray.push("C");
temporaryArray.push("G");
array.push(temporaryArray);
} else if(dna == "A"){
temporaryArray.push("A");
temporaryArray.push("T");
array.push(temporaryArray);
} else if(dna == "T"){
temporaryArray.push("T");
temporaryArray.push("A");
array.push(temporaryArray);
}
});
}
pairElement("ATCGA");
Any suggestions?