Edit: Please ignore. I found the reason why is because I was not returning mainArray.
Tell us what’s happening:
I’m completing this challenge and as I show the result of ‘mainArray’ in console, it appears to be correct. Yet the tests still fail. Why would the tests fail?
Your code so far
function pairElement(str) {
let mainArray = [];
for (let i = 0; i < str.length; i++) {
switch (str[i]) {
case 'G':
mainArray.push(['G', 'C']);
break;
case 'C':
mainArray.push(['C', 'G']);
break;
case 'T':
mainArray.push(['T', 'A']);
break;
case 'A':
mainArray.push(['A', 'T']);
break;
}
}
console.log(mainArray);
return str;
}
pairElement("ATCGA");
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:79.0) Gecko/20100101 Firefox/79.0
.
Challenge: DNA Pairing
Link to the challenge: