I have a problem with this challenge, it seems to be correct because when I test it on the developer tool console it works but on FCC console doesn’t work, where do you think the problem is?
here is the code:
function pairElement(str) {
let toArr = str.split("");
let newArr = [];
for(let i = 0; i < str.length; i++){
if(toArr[i] === "C" || toArr[i] === "G"){
if(toArr[i] === "C"){
newArr.push(["CG"]);
}else{
newArr.push(["GC"]);
}
}
if(toArr[i] === "A" || toArr[i] === "T"){
if(toArr[i] === "A"){
newArr.push(["AT"]);
}else{
newArr.push(["TA"]);
}
}
}
return newArr;
}
pairElement("GCG");