Write a program that, given a DNA strand, returns its RNA complement (per RNA transcription).
Both DNA and RNA strands are a sequence of nucleotides.
The four nucleotides found in DNA are adenine (A), cytosine (C), guanine (G) and thymine (T).
The four nucleotides found in RNA are adenine (A), cytosine (C), guanine (G) and uracil (U).
Given a DNA strand, its transcribed RNA strand is formed by replacing each nucleotide with its complement:
Another solution that introduces more advanced concepts like the ‘this’ object constructor and returning a function within a function.
Things to note:
- ‘this’ allows you to access an object when you’re creating the new object later using the module. (ie. var dnaTranscriber = new DnaTranscriber();)
- splitting a string converts it into an array
- .map allows you to apply the same method to every item in an array.