根据数组对象的属性值删除对象
2019-04-22 本文已影响0人
caiyiii
数组:arr = [{id:'1'},{id:'2'},{id:'3'}]
for(var i = 0; i < arr.length; i++){
if(arr[i].id == index) {
arr.splice(i,1);
break;
}
}
数组:arr = [{id:'1'},{id:'2'},{id:'3'}]
for(var i = 0; i < arr.length; i++){
if(arr[i].id == index) {
arr.splice(i,1);
break;
}
}