使用对象分组数组项
myArray = [ {group: "one", color: "red"}, {group: "two", color: "blue"}, {group: "one", color: "green"}, {group: "one", color: "black"}]
myArray = [ {group: "one", color: ["red", "green", "black"]} {group: "two", color: ["blue"]}]
group
.
for (i in myArray){ var group = myArray[i].group; //myArray.push(group, {???})}
繁花如伊
相关分类