摘要:
var arr = [ {id:1}, {id:2}, {id:1}];/*unique(arr, 'id'); //->[{id: 1}, {id: 2}];unique([1,2,2,2,3,3,4]); //->[1,2,3,4];unique(arr, function(item){ return item.id;}); //->[{id: 1}, {id: 2}];*/function unique(array, filter){ var tmpObject = {hasStored: {}, uniqueArray: []}, i, fun; if 阅读全文