js-mentorship-razvan / javascript

Javascript study notes
GNU General Public License v3.0
22 stars 2 forks source link

Complementary DNA #403

Closed RazvanBugoi closed 4 years ago

RazvanBugoi commented 4 years ago

https://www.codewars.com/kata/554e4a2f232cdd87d9000038/train/javascript

RazvanBugoi commented 4 years ago
function DNAStrand(dna){
  let output = '';
  for (let i=0; i<dna.length; i++) {
    if (dna[i] == 'A') {
      output += 'T';
      } else if (dna[i] == 'T') {
        output += 'A';
        } else if (dna[i] == 'C') {
          output += 'G';
          } else if (dna[i] == 'G') {
            output += 'C';
            }
    }
    return output;
}