-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday_36.js
31 lines (23 loc) · 817 Bytes
/
day_36.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Rna Transcription
// Instructions
// Given a DNA strand, return 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:
// G -> C
// C -> G
// T -> A
// A -> U
const transcription = (dna) => {
// code here
let rna = ''
for(let i=0; i<dna.length; i++) {
if(dna[i] === 'G') rna +='C'
if(dna[i] === 'C') rna +='G'
if(dna[i] === 'T') rna +='A'
if(dna[i] === 'A') rna +='U'
}
return rna
}
transcription('GCT')