数组数据去重

数据去重

indexOf #

Array.prototype.unique1 = function() {
    var arr = []
    for(var i = 0; i< this.length; i++) {
        vat item = this[i]
        if(ar.indexOf(item) === -1) {
            arr.push(item)
        }
    }
    return arr
}

https://app.yinxiang.com/shard/s12/nl/3276207/55491842-8bf4-4c55-b88f-2766ad39475a