What\'s the correct way to merge two arrays in Javascript?
I\'ve got two arrays (for example):
var a1 = [{ id : 1, name : \"test\"}, { id : 2, name :
reduce version.
var a3 = a1.concat(a2).reduce((acc, x) => { acc[x.id] = Object.assign(acc[x.id] || {}, x); return acc; }, {}); _.values(a3);
I think it's common practice in functional language.