DEV Community

Discussion on: Daily Challenge #175 - Complementary DNA

Collapse
 
ruanengelbrecht profile image
Ruan Engelbrecht

JavaScript:

const mapping = {
  A: 'T',
  T: 'A',
  C: 'G',
  G: 'C'
};

const DNA_strand = seq =>
  seq
    .split('')
    .map(x => mapping[x])
    .join('');