展示一些字符串实例
- <!DOCTYPE html>
- <html>
- <body>
- <h2>JavaScript 字符串</h2>
- <p>您可以在字符串中使用引号,只要不匹配围绕字符串的引号即可:</p>
- <p id="demo"></p>
- <script>
- var answer1 = "It's good to see you again!";
- var answer2 = "He is called 'Bill'";
- var answer3 = 'He is called "Bill"';
- document.getElementById("demo").innerHTML =
- answer1 + "<br>" + answer2 + "<br>" + answer3;
- </script>
- </body>
- </html>