运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Statements</h1> <h2>The const Statement</h2> <p>Declaring a constant array does NOT make the elements unchangeble:</p> <p id="demo"></p> <script> // Create an Array: const cars = ["Saab", "Volvo", "BMW"]; // Change an element: cars[0] = "Toyota"; // Add an element: cars.push("Audi"); // Display the Array: document.getElementById("demo").innerHTML = cars; </script> </body> </html>