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
}



pairElement("ATCGA")

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:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/dna-pairing

Yeah, why not?

Whatever it works unless the instructions tell not to use.