Array
(
[0] => Array
(
[id] => 1
[main_categories] => MCAT
[sucategory] => Chemistry
)
[1] => Array
(
[id] => 2
[main_categories] => MCAT
[sucategory] => Physics
)
[2] => Array
(
[id] => 3
[main_categories] => MCAT
[sucategory] => Biology
)
)
我想获得id
,main_categories
和subcategory
。
我使用data[0]
只返回A
。
答案 0 :(得分:1)
let data = [
{
id: 1,
main_categories: "MCAT",
sucategory: "Chemistry"
},
{
id: 2,
main_categories: "MCAT",
sucategory: "Physics"
},
{
id: 3,
main_categories: "MCAT",
sucategory: "Biology"
}
];
console.log(data[0])