How to append or concat strings in Javascript?

后端 未结 2 1180
感动是毒
感动是毒 2021-01-26 18:33

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) {
             


        
2条回答
  •  执念已碎
    2021-01-26 18:56

    mRNA.concat(b); doesn't mutate the string, it only computes the value. You need tomRNA = mRNA.concat(b) (or mRNA = mRNA + b) to change the value of mRNA.

提交回复
热议问题