从目标数组中删除满足条件的元素
//从目标数组中删除满足条件的元素 function removeItemForArray (src, cb) { var counter = src.length - 1; while (true) { var result = cb(src[counter]); if (result) { src.splice(counter, 1); counter = src.length - 1; } else { counter--; } if (counter < 0) { break; } } } var arr=[ {'Id':1, 'Value':100}, {'Id':2, 'Value':230} ,{'Id':3, 'Value':63}]; console.log(arr); removeItemForArray(arr, c => c.Id== 2 ) console.log(arr);