

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
DNA to RNA conversion using JavaScript
DNA And RNA Relation
Deoxyribonucleic acid, DNA is the primary information storage molecule in biological systems. It is composed of four nucleic acid bases Guanine ('G'), Cytosine ('C'), Adenine ('A'), and Thymine ('T').
Ribonucleic acid, RNA, is the primary messenger molecule in cells. RNA differs slightly from DNA its chemical structure and contains no Thymine. In RNA Thymine is replaced by another nucleic acid Uracil ('U').
Problem
We are required to write a JavaScript function which translates a given DNA string into RNA.
Example
Following is the code −
const DNA = 'GCAT'; const DNAtoRNA = (DNA) => { let res = ''; for(let i = 0; i < DNA.length; i++){ if(DNA[i] === "T"){ res += "U"; }else{ res += DNA[i]; }; }; return res; }; console.log(DNAtoRNA(DNA));
Output
GCAU
- Related Questions & Answers
- Decimal to binary conversion using recursion in JavaScript
- Repeated DNA Sequences in C++
- Object to Map conversion in JavaScript
- Binary to original string conversion in JavaScript
- Add number strings without using conversion library methods in JavaScript
- Decimal to Binary conversion using C Programming
- DNA App Store: Wish to gain insights about your genes?
- Data Conversion Using valueOf() In Java.
- Decimal to Binary conversion
- Number to word conversion
- How to write the temperature conversion table by using function?
- Conversion of Hex decimal to integer value using C language
- Explain Digital to Analog Conversion
- Binary Tree to Binary Search Tree Conversion using STL set C++?
- Conversion of whole String to uppercase or lowercase using STL in C++
Advertisements