filter

Array.prototype.myFilter = function(callback){
    let arr = []
    for(let i = 0;i < this.length;i++){
        let item = this[i]
        if(callback(item,i,this)){
            arr.push(item)
        }
    }
    return arr
}  
posted @ 2020-07-24 21:30  671_MrSix  阅读(76)  评论(0编辑  收藏  举报