Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

DNA Pairing solution

function pairElement(str) {
  let pairs = {
    'A' : 'T',
    'T' : 'A',
    'C' : 'G',
    'G' : 'C'
  }
  return str.toUpperCase().split('').map(letter => [letter, pairs[letter]]);
  // str.toUpperCase() in case of lowercase letters to avoid errors
}

pairElement("GCGAt");
 
PREVIOUS NEXT
Tagged: #DNA #Pairing #solution
ADD COMMENT
Topic
Name
1+5 =