js,javascript陣列物件的父級物件 – 子集物件(陣列物件相減)

失落的額頭發表於2017-12-29
<!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>

相關文章