Last active
November 22, 2015 04:01
-
-
Save minsooshin/9ca05282d68aae69e03f to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/minsooshin 's solution for Bonfire: DNA Pairing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bonfire: DNA Pairing | |
// Author: @minsooshin | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-dna-pairing | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function pair(str) { | |
var pairing = { | |
"A": "T", | |
"T": "A", | |
"C": "G", | |
"G": "C" | |
}, | |
final = []; | |
final = str.split('').map(function(val) { | |
var arr = []; | |
arr.push(val, pairing[val]); | |
return arr; | |
}); | |
return final; | |
} | |
pair("GCG"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment