js数组删除另一个数组存在的值
var selectStudentList=[{id:1,name:"张三"},{id:2,name:"李四"},{id:3,name:"王五"}];
var studentList=[{id:1,name:"张三", age:"12"}];for(var i=0;i<studentList.length;i++){ for(var j=0;j<selectStudentList.length;j++){ if(selectStudentList[j].id==studentList[i].id){ selectStudentList.splice(j,1); j--; } }}console.log(selectStudentList);

浙公网安备 33010602011771号