声明(创建)数组
- <!DOCTYPE html>
- <html>
- <body>
- <h2>JavaScript 数组</h2>
- <p>数组索引基于零,这意味着第一个项目是 [0],第二个项目是 [1],以此类推。</p>
- <p id="demo"></p>
- <script>
- var cars = ["Porsche", "Volvo", "BMW"];
- document.getElementById("demo").innerHTML = cars[0];
- </script>
- </body>
- </html>