Array.prototype.unique = function() {
var temp = {},
result = [],
len = this.length;
for (var i = 0; i < this.length; i++) {
if(!temp[this[i]]) {
temp[this[i]] = 'abc';
result.push(this[i]);
}
}
return result;
}
【javascript】——数组去重 ,要求在原型链上编程
猜你喜欢
转载自www.cnblogs.com/hjysunshine/p/12151459.html
今日推荐
周排行