展示一些字符串实例

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <h2>JavaScript 字符串</h2>
  6.  
  7. <p>您可以在字符串中使用引号,只要不匹配围绕字符串的引号即可:</p>
  8.  
  9. <p id="demo"></p>
  10.  
  11. <script>
  12.  
  13. var answer1 = "It's good to see you again!";
  14. var answer2 = "He is called 'Bill'";
  15. var answer3 = 'He is called "Bill"';
  16.  
  17. document.getElementById("demo").innerHTML =
  18. answer1 + "<br>" + answer2 + "<br>" + answer3;
  19.  
  20. </script>
  21.  
  22. </body>
  23. </html>