Skip to content

Instantly share code, notes, and snippets.

@ArielLeslie
Created October 22, 2015 19:55
Show Gist options
  • Save ArielLeslie/f1b92fdec08d5227669a to your computer and use it in GitHub Desktop.
Save ArielLeslie/f1b92fdec08d5227669a to your computer and use it in GitHub Desktop.
Bonfire: DNA Pairing
function pair(str) {
var pairs = [['A', 'T'], ['C', 'G']];
var myPairs = [];
for (i = 0; i < str.length; i++){
for(j = 0; j < pairs.length; j++){
var index = pairs[j].indexOf(str[i]);
if (index >= 0) {
myPairs.push([pairs[j][index], pairs[j][3%(index+2)]]);
}
}
}
return myPairs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment