Created
February 2, 2016 11:57
-
-
Save anonymous/51d5463bf53b413b2c6a to your computer and use it in GitHub Desktop.
https://repl.it/Biuj/0 created by sri.pgp@gmail.com
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
| pairs = [["A", "T"],["C","G"]] | |
| function pair(str) { | |
| tempArray = []; | |
| for (j=0;j<str.length;j++){ | |
| for (i=0;i<pairs.length;i++) { | |
| indexValue = pairs[i].indexOf(str.charAt(j)); | |
| if(indexValue==0) { | |
| tempArray.push(pairs[i].slice()); | |
| } else if (indexValue == 1) { | |
| pairs[i].reverse(); | |
| tempArray.push(pairs[i].slice()); | |
| } | |
| } | |
| } | |
| return tempArray; | |
| } |
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
| Native Browser JavaScript | |
| >>> => [ [ 'A', 'T' ], [ 'C', 'G' ] ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment