Hexlet doesn not really work properly in your browser, because it is pretty old.
Please, upgrade. Choose browser.

DNA and RNA are sequences of nucleotides.

Four nucleotides in DNA are adenine (A), cytosine (C), guanine (G) and thymine (T).

Four nucleotides in RNA are adenine (A), cytosine (C), guanine (G) и uracil (U).

RNA is constructed based on the DNA sequence by replacing each nucleotide as follows:

  • G -> C
  • C -> G
  • T -> A
  • A -> U

dnaToRna.js

Implement and export a function as default that takes a DNA string and returns the corresponding RNA string.

If the parameter includes no nucleotides (in other words, an empty string is passed), then the function should return an empty string.

If the incoming DNA includes an "unknown" nucleotide, the function should return null.

dnaToRna('ACGTGGTCTTAA'); // 'UGCACCAGAAUU'
dnaToRna('CCGTA'); // 'GGCAU'
dnaToRna(''); // ''
dnaToRna('ACNTG'); // null
Start challenge Successful completion: 94%

Last code review

User Updated at Submissions count
alek_web 09 Mar 09:41 1
joisadler 09 Mar 09:41 1