How to append or concat strings in Javascript?(如何在 Javascript 中追加或连接字符串?)
问题描述
所以我试图添加到一个字符串,它显示为空.
So I'm trying to add to a string and it shows up as empty.
它应该在控制台中显示 AUC,但它只是空白.顺便说一下,这是通过 Firefox 实现的.
Its supposed to show AUC in the console but its just blank. This is through firefox by the way.
推荐答案
mRNA.concat(b);
不会改变字符串,它只会计算值.您需要mRNA = mRNA.concat(b)
(或mRNA = mRNA + b
)来改变mRNA
的值.
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
.
这篇关于如何在 Javascript 中追加或连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!