//数组去重
Array.prototype.unique = function() {
    var newArr = [], hash = {};
    for(var i=0, len=this.length; i<len; i++) {
        if(!hash[this[i]]) {
            newArr.push(this[i]);
            hash[this[i]] = true;
        }
    }
    return newArr;
}

 

 posted on 2015-07-30 10:03  晨祥  阅读(116)  评论(0编辑  收藏  举报