📌  相关文章
📜  创建具有多个数组的 json 对象 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:53.477000             🧑  作者: Mango

代码示例4
data.cars['Nissan'][0].model   // Sentra
data.cars['Nissan'][1].model   // Maxima
data.cars['Nissan'][2].doors   // 2

for (var make in data.cars) {
    for (var i = 0; i < data.cars[make].length; i++) {
        var model = data.cars[make][i].model;
        var doors = data.cars[make][i].doors;
        alert(make + ', ' + model + ', ' + doors);
    }
}