Skip to content

Instantly share code, notes, and snippets.

@clint74
Created November 25, 2015 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clint74/380f2b01c494bdb9bf10 to your computer and use it in GitHub Desktop.
Save clint74/380f2b01c494bdb9bf10 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/clint74 's solution for Bonfire: DNA Pairing Using functional aproach.
// Bonfire: DNA Pairing
// Author: @clint74
// Challenge: http://www.freecodecamp.com/challenges/bonfire-dna-pairing
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function pair(str) {
var get_pair = {"A": "T", "T": "A", "C":"G", "G":"C" };
var map = Array.prototype.map;
var dna_chain = map.call(str, function(elem){
return [elem, get_pair[elem]];
});
return dna_chain;
}
pair("GCG");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment