I have two arrays one is an original array and second is the copy of an original array. I put some new items in an array and update some of one and want to compare it with copy array and want to eliminate those items which are in copy array and keep those items where Id = null
var original = [
{
"Id": 1,
"BrandConstruct": 265,
"YearPlanData": "a"
},
{ "Id": 2,
"BrandConstruct": 236,
"YearPlanData": "c"
},
{ "Id": 3,
"BrandConstruct": 376,
"YearPlanData": "b"
},
{ "Id": null,
"BrandConstruct": 476,
"YearPlanData": "e"
},
{ "Id": null,
"BrandConstruct": 576,
"YearPlanData": "f"
}
]
var copy = [
{
"Id": 1,
"BrandConstruct": 165,
"YearPlanData": "a"
},
{ "Id": 2,
"BrandConstruct": 236,
"YearPlanData": "c"
},
{ "Id": 3,
"BrandConstruct": 376,
"YearPlanData": "b"
}
]
These are two arrays with properties Id, BrandConstruct, YearPlanData I add the new item or may be multiple items where all will have Id = null and other properties will have any data or may be duplicate data so I want to eliminate duplicate data using copy array but keep data where Id = null so I want this type of result after comparison and it must be work on IE
var original = [
{
"Id": 1,
"BrandConstruct": 265,
"YearPlanData": "a"
},
{ "Id": null,
"BrandConstruct": 476,
"YearPlanData": "e"
},
{ "Id": null,
"BrandConstruct": 576,
"YearPlanData": "f"
}
]