DEV Community

Discussion on: Five Ways to Solve the DNA Pairing Challenge in JavaScript

Collapse
 
mer7in profile image
Mer7in

Hope this help

const _DNA={
'A':['A','T'],
'T':['T','A'],
'C':['C','G'],
'G':['G','C']
}
function pairElement(str) {
let arr=[];
str=str.split('');
str.forEach((element)=>{
arr.push(_DNA[element])
})
return arr;
}

console.log(pairElement("GCG"));

Collapse
 
bam92 profile image
Abel Lifaefi Mbula

Thanks for sharing.