Good evening! Struggling with searches for a long time, help to understand? Suppose there are arrays # 1 and # 2, now I’ll present them below:
var array1 = [ {elem_id: 1, name: 'Watch', active: true}, {elem_id: 2, name: 'System', active: false}, {elem_id: 3, name: 'Process', active: false, ... ]; var array2 = [ {category: 'App', name: 'Watch', active: false}, {category: 'App', name: 'Table', active: true}, {category: 'App', name: 'System', active: false}, {category: 'App', name: 'Process', active: true}, ... ]; It is necessary to achieve such that on an output the array with the joint data turned out. The check must be by 'name'. If it is the same, then the value is 'active', should migrate from the array # 1 and the array # 2. Now I shall depict what should come out as a result of my examples.
Because in the first array and in the second are the same 'name' - this is "Watch, System, Process", then all the data of the second array fall into the array # 3, but with the 'active' parameters from the first array. Total:
var array3 = [ {category: 'App', name: 'Watch', active: true}, // было false, стало true; {category: 'App', name: 'Table', active: true}, {category: 'App', name: 'System', active: false}, {category: 'App', name: 'Process', active: false}, // было true, стало false; ... ]; Thank you very much!