0

I created var object then put in key and values.

I can call key and object[key] however there are some keys that are repeated such as

    key = A,
    key = B,
    key = A,
    key = B

I want to separate the first two objects in array[0][0] and array[0][1] and the other two in array[1][0] and array[1][1]. Is this possible?

Thanks in advance!

4

1 回答 1

0

根据您的需要,您可以制作一个这样的数组数组。

var arr  = new Array();
arr.push([{key:"A"}, {key:"B"}]);
arr.push([{key:"A"}, {key:"B"}]);

控制台日志=>

arr[0][0]
Object {key: "A"}
arr[0][1]
Object {key: "B"}
arr[1][0]
Object {key: "A"}
arr[1][1]
Object {key: "B"}
于 2013-09-04T02:33:25.470 回答