javascript删除数组里的对象

Array.prototype.del = function(value) {
    //删除数组中指定的元素,返回新数组
    function hasValue(array, value) {
        for(var i = 0; i < array.length; i++) {
            if (value == array[i]) {
                return i;
            }
        }
        return -1;
    }
    var position = hasValue(this, value);
    var temp = new Array ;
    if(position != -1) {
        temp = this.slice(0, position).concat(this.slice(position+1, this.length));
        return temp;
    }
    return this;
}
原文地址:https://www.cnblogs.com/sunxucool/p/3217150.html