js数组删除元素、json删除元素
//数组
var b=[1,2,3,4]; b.splice(b.indexOf(2,1)) //1,3,4
//json var arrayId=[{"id":233,"name":"英语"},{"id":122,"name":"语文"},{"id":10,"name":"数学"}] for(var i=0;i<arrayId.length;i++){ if (arrayId[i].id == item.id){//item.id==122
arrayId.splice(i,1)
}
} //{"id":233,"name":"英语"},{"id":10,"name":"数学"}