Tell us what’s happening:
I am getting the correct solution when I console.log but when I change that to a return statement it no longer works. Can anyone help me understand why? Thanks.
Your code so far
function pairElement(str) {
let test = str.split("");
let sample = []
for (let i in test){
sample.push(test[i].split())
}
arrayConst(sample);
function arrayConst(array){
for (let i in array){
if (array[i][0] === 'G') {
array[i].push('C')
} else if (array[i][0] === 'C') {
array[i].push('G')
} else if (array[i][0] === 'A') {
array[i].push('T')
} else if(array[i][0] === 'T') {
array[i].push('A')
}
}
console.log(array);
return array;
}
}
pairElement("ATCGA");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
.
Challenge: DNA Pairing
Link to the challenge: