Quotes help make search much faster. Example: "Practice Makes Perfect"

Saturday, May 13, 2017

FreeCodeCamp DNA Pairing Sample Solution


function pairElement(str) {
  var pairs = {
    'G':'C',
    'C':'G',
    'A':'T',
    'T':'A'
  };
  var arr = str.split("");
  var arrPairs = [];
  for(var i=0; i<arr.length; i++){
    arrPairs.push([arr[i],pairs[arr[i]]]);
  }
  return arrPairs;
}

pairElement("GCG");

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts