DNA Pairing: validation

Tell us what’s happening:

I made a an object DNA and then I simply inserted the corresponding pair that match the argument is it valid although i passed the test?

Your code so far

function pairElement(str) {
  const DNA = {"A":["A","T"],"T":["T","A"],"G":["G","C"],"C":["C","G"]};
let keys = Object.keys(DNA);
let rs = str.split("")
let arr =[];
let rr = rs.map(a=>{
 for (var i in keys){
     if (a === keys[i]){
 return  arr.push(DNA[keys[i]])
return arr


Your browser information:

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

Link to the challenge:

Yeah, why not?

Whatever it works unless the instructions tell not to use.

It works, but your solution uses map and an for loop inside the map. See if you can solve the problem by just using the following for DNA.

const DNA = {A: "T", T: "A", G: "C", C: "G"};

The above could be used to return the matching pair element for a given letter. Using the above line and the map method (without the extra inner for loop), you can solve this challenge in 2-3 lines of code. See if you can do it.