米琪卡哇伊
function filter(students) { var obj = {}; var result = []; for (var i = 0, len = students.length; i < len; i++) { var item = students[i]; var groupid = item.groupid; var groupname = item.groupname; var id = groupid + groupname; if (!id) continue; var index = obj[id]; var current; if (index) { result[index].g_count++; } else { result.push({ g_id: groupid, g_name: groupname, g_count: 1 }); obj[id] = result.length - 1; } } return result;}filter(students);