日期:2014-05-16 浏览次数:20327 次
Array.prototype.distinct = function() { var ret = []; for (var i = 0; i < this.length; i++) { for (var j = i+1; j < this.length;) { if (this[i].id === this[j].id) { ret.push(this.splice(j, 1)[0]); } else { j++; } } } return ret; }