如何在JavaScript中串联多个字符串变量?
要串联多个字符串变量,请使用JavaScript串联运算符。
示例
您可以尝试运行以下代码来连接变量
<html> <body> <script> var str1 = "Tutorials "; var str2 = "Point: "; var str3 = "Simply Easy Learning" var res = str1 + str2 + str3; document.write("String 1 = "+str1); document.write("<br>String 2 = "+str2); document.write("<br>String 3 = "+str3); document.write("<br>After concatenaton: "+res); </script> </body> </html>