W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h2>JavaScript const</h2> <p>您无法重新赋值常量数组:</p> <p id="demo"></p> <script> try { const cars = ["Saab", "Volvo", "BMW"]; cars = ["Toyota", "Volvo", "Audi"]; } catch (err) { document.getElementById("demo").innerHTML = err; } </script> </body> </html>