我有一個數組,在這個數組中會保存一個JavaScript對象。其他數組的數組數
var items = [];
var item = {
id: data.id,
kategorie: data.kategorie,
name: data.name
}
items.push(item); // that will be done few times
現在我有這樣的
items[0] = id: 1, kategorie: "scheduled", name: "Test1"
items[1] = id: 2, kategorie: "queued", name: "Test2"
items[2] = id: 3, kategorie: "recorded", name: "Test3"
items[3] = id: 4, kategorie: "recorded", name: "Test4"
items[4] = id: 5, kategorie: "recorded", name: "Test5"
我想指望這個數組項。至少最後一個數組應該是這樣的。
arrayFinal[0] = kategorie: "scheduled", counted: 1
arrayFinal[1] = kategorie: "recorded", counted: 3
我該怎麼做?
謝謝:):D –