是的,但它被称为对象,而不是数组.
arr = [{col1: 'Firstname', col2: 'Lastname'},
{col1: 'Firstname', col2: 'Lastname'}];
您可以通过以下方式访问(赋值或检索)值 you can access (assign or retrieve) the values byarr[0]['col1']
and even arr[0].col1
.
为了便于说明,看起来像具有字符串键的数组的数据结构称为对象。此示例仍然使用数组(带有数字键)。EDIT: For clarification the data structure that looks like an array with string keys is called an object. This example is still using an array (with numeric keys).