Javascript根据属性从对象数据中删除元素
/**
* 按Key删除
* 参数val最好限于数字或字符串
*/
removeByKey(array,key,val){
if(ArrayUtils.isNotEmptyByProto(array)){
let len = array.length;
let ind = 0;
let currentInd = 0;
while (ind < len){
let currentObj = array[currentInd];
if(currentObj!=null && currentObj[key] == val){
array.splice(currentInd, 1);
}else {
currentInd++;
}
ind ++;
}
}
return array;
},