data = [{'userId':1,'a':11},{'userId':3,'a':33},{'userId':2,'a':22},{'userId':1,'a':11}]
var hash = [];
var obj = {};
$.each(data,function (i,item) {
if(!obj[item.userId]){
obj[item.userId] = item;
hash.push(item);
}
});
console.log(obj);
console.log(hash);
08-08
1万+

被折叠的 条评论
为什么被折叠?



