So I'm trying to add to a string and it shows up as empty.
var DNA = "TAG";
var mRNA = "";
m_RNA()
function check(a, b, string) {
if (string = a) {
mRNA.concat(b);
}
}
function m_RNA(){
//console.log(DNA)
for (var i = 0; i < DNA.length; i++) {
console.log("Checking: " + DNA[i]);
check("T", "A", DNA[i]);
check("A", "U", DNA[i]);
check("C", "G", DNA[i]);
check("G", "C", DNA[i]);
console.log(mRNA);
}
}
Its supposed to show AUC in the console but its just blank. This is through firefox by the way.
+operator concatenates strings:"hello" + " " + "world"is"hello world"(which you apparently already know because you use that in aconsole.log()call)mRNA = mRNA.concat(b)iftest incheck()needs to use==not=