最佳答案
我尝试创建以下内容:
var employees = {
"accounting": [ // accounting is an array in employees.
{
"firstName": "John", // First element
"lastName": "Doe",
"age": 23
},
{
"firstName": "Mary", // Second Element
"lastName": "Smith",
"age": 32
}
] // End "accounting" array.
} // End Employees
我从
var employees = new Array();
如何继续动态地创建数组(可能用变量更改 firstName
) ?我好像没有把嵌套数组搞对。