Codewars: DNA to RNA Conversion (8 kyu) TDD in JavaScript


Hi! Welcome to Codewars. In this series I gonna solve TDD katas using
JavaScript. I’m Anatol and you are watching the Good Parts
of the FrontEnd development. If this is your first time here start now
by subscribing. Let’s solve today a kata titled “DNA to RNA
convertion”. I need create a function wich translate a
given DNA string into RNA. In RNA Thymine is replaced by another nucleic
acid Uracil (‘U’). Good. So, I need to replace only one letter in this
string. Good. Let’s do that. Return “dna” replace T to U. Let’s check. Now it’s now enough. I replaced only one element and don’t replace
all other elements. So I need to use a Regular Expression for
that. I check for all elements globaly, and replace
them. Let’s try. Yes, now that’s correct. And also let’s use an arrow function for that. It will be even shorter solution. And then return a replaced string. Let’s check. Yes, good. It works, I like it. My code is available on GitHub. Documentation is available in the Internet. Follow the link if you’re eager to get more. If you like this video give it “thumbs up”,
share it with your friends, subscribe to the channel and watch other episodes. Thanks for watching and dive deeper.

Add a Comment

Your email address will not be published. Required fields are marked *