给数组增加remove函数

//给数组增加indexOf函数
Array.prototype.indexOf = function(val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) return i;
}
return -1;
};

//给数组增加remove函数
Array.prototype.remove = function(val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};

使用:
vm.recordArr.remove(record);
原文地址:https://www.cnblogs.com/52wxb1314/p/10943957.html