我正在尝试创建以下内容:
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
随变量变化)?我似乎没有得到正确的嵌套数组。