Вы попали на английскую версию сайта. Большая часть курсов доступна на русском языке

DNA to RNA Course Challenge: Intro to Programming

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


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('CCGTA'); // 'GGCAU'
dnaToRna(''); // ''
dnaToRna('ACNTG'); // null
Successful completion: 95%

For full access to the challenge you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, the opportunity to seek help from mentors and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
hours of theory

Last code review

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