Intermediate Algorithm Scripting - DNA Pairing

Tell us what’s happening:
Describe your issue in detail here.
can you tell me the problem of my code, thank you

   **Your code so far**
function pairElement(str) {
let result = [];
for(let element of str) {
if(element === "A") {
 result.push(["A","T"])
 } else if(element ==="T") {
result.push(["T","A"])
} else if (element === "C") {
result.push(["C","G"])
} else  (element === "G") {
result.push(["G","C"])
} 
}
 return result;
}

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/103.0.0.0 Safari/537.36

Challenge: Intermediate Algorithm Scripting - DNA Pairing

Link to the challenge:

You have a slight mistake here that’s throwing off your code. Else cannot be followed by a condition.

1 Like

thank you very much.

1 Like