对两个字符串相加,第一个字符串中包含空格
- <!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>