2 回答
月关宝盒
TA贡献1772条经验 获得超5个赞
var a = [{material_id : '29', name : '点塑布'}, {material_id : '14', name : '沙发布'}, {material_id : '54'}, {material_id : '51'}, {material_id : '53'}, {material_id : '54'}, {material_id : '53'}, {material_id : '51'}],
n = a.reduce(function(p, n) {
return p.push(n.material_id), p;
}, []).filter(function(e, i, a) {
return a.indexOf(e) !== i;
}),
m = a.filter(function(e) {
return n.indexOf(e.material_id) === -1;
});
alert(JSON.stringify(m)); // [{material_id : '29', name : '点塑布'}, {material_id : '14', name : '沙发布'}]
添加回答
举报
0/150
提交
取消