x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript 语句</h1>
<h2>const 语句</h2>
<p>声明一个常量数组不会使元素不可更改:</p>
<p id="demo"></p>
<script>
// 创建数组:
const cars = ["GEELY", "Volvo", "BYD"];
// 修改元素:
cars[0] = "Audi";
// 添加元素:
cars.push("Porsche");
// 显示数组:
document.getElementById("demo").innerHTML = cars; 
</script>
</body>
</html>