在Javascript中添加字符到一个字符串 [英] Add characters to a string in Javascript
本文介绍了在Javascript中添加字符到一个字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
var last_name =jones;
var name = first_name.concat(last_name)
工作。
任何想法如何做另一种方式?
我的代码:
var text =;
for(var list in list){
text.concat(list [member]);
$ / code>
解决方案
var text =;
for(var list in list){
text + = list [member];
}
I need to add in a For Loop characters to an empty string. I know that you can use the function concat in Javascript to do concats with strings
var first_name = "peter";
var last_name = "jones";
var name=first_name.concat(last_name)
but with my example it doesn't work. Any idea how to do it another way ?
my code :
var text ="";
for (var member in list) {
text.concat(list[member]);
}
解决方案
var text ="";
for (var member in list) {
text += list[member];
}
这篇关于在Javascript中添加字符到一个字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文