对两个字符串相加,字符串之间有空格
- <!DOCTYPE html>
- <html>
- <body>
- <h1>JavaScript 运算符</h1>
- <p>+ 运算符级联(相加)字符串。</p>
- <p id="demo"></p>
- <script>
- var txt1 = "What a very";
- var txt2 = "nice day";
- document.getElementById("demo").innerHTML = txt1 + " " + txt2;
- </script>
- </body>
- </html>