我正在尝试创建以下内容:
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
随变量更改)?我似乎没有正确的嵌套数组。
8
在javascript中创建数组的首选方法是var employeeess = []; 不是var employee = new Array();
—
Mattias Jakobsson