let arr1 = [{id:1,name:'bj'},{id:2,name:'sh'}];
let arr2 = [{id:3,name:'bj'},{id:2,name:'sh'},{id:4,name:'nj'}];let arr = arr1.concat(arr2);
let map = new Map();for (let i = 0, len = arr.length; i < len; i++) {
if (!map.has(arr[i].id)) { map.set(arr[i].id, arr[i]); } else { let t = map.get(arr[i].id); t.common = ['1', '1']; map.set(arr[i].id, t); }}let result = Array.from(map.values());
console.dir(result);