Implement a DNA Pair Generator - Implement a DNA Pair Generator

Tell us what’s happening:

I don’t know what is the problem, any answer???

Your code so far

function pairElement(str){
  const pairElements = [["A","T"],["T","A"],["C","G"],["G","C"]];// 
  let pairs = [];//the new array
  for (let element = 0; element < str.length; element++){//elements of the string
    for(pairElement of pairElements){//compare elements with pairs of the elements
      if(str[element] == pairElement[0]){
        pairs.push(pairElement);
      }
    }
  }
  return pairs;
}

console.log(pairElement("ATCGA"));



Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 OPR/127.0.0.0

Challenge Information:

Implement a DNA Pair Generator - Implement a DNA Pair Generator

This test: console.log(pairElement("TTGAG")); produces an error in the console:

TypeError: pairElement is not a function

1 Like

Thanks, the console was returning the answer without errors, that’s why I didn’t see it.