js数组去重方法封装

Array.prototype.unique = function (){
    var temp = {},
    arr = [],
    len = this.length;
    for(var i = 0; i < len; i++){
        if(!temp[this[i]]){
            temp[this[i]] = 'abc';
            arr.push(this[i]);
        }
    }
    return arr;
}        
原文地址:https://www.cnblogs.com/summer-qd/p/10954364.html