So my code returns the right array for all the inputs on pairElement() but i cannot proceed. i printed the result to the console to check and all the result are correct . Below is the code
function pairElement(str) {
var pairs = ["GC","AT"] //prepare the pairs
var items = str.split(""); //turn str to array items
var arr = []; //initialize the collector
for(let x = 0; x < items.length; x++){
var c = (pairs.filter((m)=> m.includes(items[x]))).toString(); //filter out pairs using each item
var pair = c.split(items[x]).join(""); //get pair from pairs
arr.push(`["${items[x]}","${pair}"]`); //Concat pair with item and pass to collector
}
return arr;
}
pairElement("GCG");
Please Assist.