js數組對象的父數據對象-子數組對象,(數組對象相減)
阿新 • • 發佈:2017-11-03
length 相減 set push != arr pro edi script
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var gridData_1=[{"name":"123",age:12},{"name":"124",age:13},{"name":"125",age:14}];
var edit_xiugai=[{"name":"123",age:12},{"name":"124",age:13}];
var arr_null=[];
for(var arr_1=0;arr_1<gridData_1.length;arr_1++){
var ss=true;
var aa=true;
for(var arr_2=0;arr_2<edit_xiugai.length;arr_2++){
if(gridData_1[arr_1].name!=edit_xiugai[arr_2].name && gridData_1[arr_1].age!=edit_xiugai[arr_2].age&&aa==true){
ss=false;
}
else{
ss=true;
aa=false;
}
}
if(ss==false){
var pro_sum={name:gridData_1[arr_1].name,age:gridData_1[arr_1].age};
arr_null.push(pro_sum);
}
}
console.log(arr_null);
</script>
</body>
</html>
js數組對象的父數據對象-子數組對象,(數組對象相減)