DNA Pairing: correct in console, but isn't passing tests?

Can you help me understand why my code is giving the correct output to the console but not in fCC?

function pairElement(str) {
  let gene = [];

  str.split("").map((letter) => {
    switch (letter) {
      case "A": 
        gene.push(["A, T"]);
      case "T": 
        gene.push(["T, A"]);
      case "G": 
        gene.push(["G, C"]);
      case "C": 
        gene.push(["C, G"]);
  return gene;


thanks for any and all thoughts!

It is not correct in the console. You are supposed to be pushing arrays with two elements each time. Instead you are pushing single string elements which look like ā€œC, Gā€.

The first test case should look like:

[ [ 'A', 'T' ], [ 'T', 'A' ], [ 'C', 'G' ], [ 'G', 'C' ], [ 'A', 'T' ] ]

but your solution returns:

[ [ 'A, T' ], [ 'T, A' ], [ 'C, G' ], [ 'G, C' ], [ 'A, T' ] ]
1 Like

:woman_facepalming: once again you come to the rescue. thanks, Randell :slight_smile: