js,javascript数组对象的父级对象 - 子集对象(数组对象相减)

<!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>
    原文作者:失落的额头
    原文地址: https://segmentfault.com/a/1190000012637683
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞