How can I append a word to an already populated string variable with spaces?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Like this:
var str = 'blah blah blah';
str += ' blah';
str += ' ' + 'and some more blah';
回答2:
var str1 = 'abc';
var str2 = str1+' def'; // str2 is now 'abc def'
回答3:
var str1 = "add";
str1 = str1 + " ";
Hope that helps,
Dan
回答4:
Ronal, to answer your question in the comment in my answer above:
function wasClicked(str)
{
return str+' def';
}