创建 JavaScript 变量

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <h2>JavaScript 变量</h2>
  6.  
  7. <p id="demo"></p>
  8.  
  9. <script>
  10. // 创建并显示变量:
  11. var car = "porsche";
  12. document.getElementById("demo").innerHTML = car;
  13. </script>
  14.  
  15. </body>
  16. </html>