W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h1>JSON 数组</h1> <p>访问 JSON 对象的数组值。</p> <p id="demo"></p> <script> var myObj, x; myObj = { "name":"Bill Gates", "age":62, "cars":[ "Porsche", "BMW", "Volvo" ] }; x = myObj.cars[0]; document.getElementById("demo").innerHTML = x; </script> </body> </html>