JavaScript 字符串相加

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <h1>JavaScript 变量</h1>
  6.  
  7. <p>相加 "Bill" + " " + "Gates" 的结果是:</p>
  8.  
  9. <p id="demo"></p>
  10.  
  11. <script>
  12. var x = "Bill" + " " + "Gates";
  13. document.getElementById("demo").innerHTML = x;
  14. </script>
  15.  
  16. </body>
  17. </html>