i have bellow two object arrays
var array_1 = [{"Date": "2020-04-01", "Item" : 001},{"Date": "2020-04-03", "Item" : 002}]
var base_array = [{"Date": "2020-04-01", "Item" : null}, {"Date": "2020-04-02", "Item" : null},
{"Date": "2020-04-04", "Item" : null}]
i planning modify array_1 as bellow
var array_1 = [{"Date": "2020-04-01", "Item" : 001},
{"Date": "2020-04-02", "Item" : null},
{"Date": "2020-04-03", "Item" : 002},
{"Date": "2020-04-04", "Item" : null}]
since date "2020-04-02" and "2020-04-04" not exist in array_1, those dates should be push with "item" null and "2020-04-01" should not be push since its already exist in array_1.
i've tried make following each loop but not able to continue
small note : base_array will always contain more value than array_1. so that why i used base_array as my initial loop
$.each(base_array , function (key,bvalue) {
$.each(array_1, function (key,value) {
if(bvalue.Date != value.Date){
array_1.push({"Date" : value.Date, "Item": value.Item})
}
})
})