📜  javascript代码示例中的结构数据

📅  最后修改于: 2022-03-11 15:04:09.751000             🧑  作者: Mango

代码示例2
var item,
    i = 0,
    groups = {},
    year, day;
while (item = eventsArray[i++]) {
    item = new Date(item.date);
    year = item.getFullYear();
    day = item.getDate();
    groups[year] || (groups[year] = {}); // exists OR create {}
    groups[year][day] || (groups[year][day] = []);  // exists OR create []
    groups[year][day].push(item);
}