非常简单,就用一个"+"将两个字符串"相加":
要将多个字符串累积为一个字符串,还可以使用"+="操作符:
result += "My name is Anders"
result += " and my age is 25";
要在字符串中添加换行符,需要使用转义字符"":
<div class="jb51code">
<pre class="brush:js;">
var confirmString = "You did not enter a response to the last " +
"question.Submit form anyway?";
var confirmValue = confirm(confirmString);