访问整个数组

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <h1>JavaScript 数组</h1>
  6.  
  7. <p id="demo"></p>
  8.  
  9. <script>
  10. var cars = ["Audi", "BMW", "porsche"];
  11. document.getElementById("demo").innerHTML = cars;
  12. </script>
  13.  
  14. </body>
  15. </html>