【问题标题】:How to access nested arrays in objects from a particular record?如何从特定记录访问对象中的嵌套数组?
【发布时间】:2016-01-04 09:23:49
【问题描述】:

这是示例 JSON 对象。 访问第二条记录的列表数组的方法是什么?

var myPlants = [
  { 
    type: "flowers",
    list: [
      "rose",
      "tulip",
      "dandelion"
    ]
  },
  {
    type: "trees",
    list: [
      "fir",
      "pine",
      "birch"
    ]
  }  
];

【问题讨论】:

    标签: javascript arrays json object


    【解决方案1】:

    你可以这样访问它:

    myPlants[1].list
    

    【讨论】:

      猜你喜欢
      • 2016-11-05
      • 2017-11-27
      • 2020-08-21
      • 2019-10-31
      • 2022-01-08
      • 2019-11-02
      • 2018-08-28
      • 2020-12-15
      • 2015-08-13
      相关资源
      最近更新 更多