var arrayObj=[
{
ID:1
},{
ID:2
}
]
removeByID(2)
// id json对象的key
function removeByID (ID) {
//获取数组中id为2的对象
let removeObj = arrayObj.find(element => {
return element.ID === ID
})
var index = arrayObj.indexOf(removeObj)
if (index !== -1) {
arrayObj.splice(index, 1)
}
}