for (var i = 0; i < 8; i++){ for (var j = 0; j < arr2.length; j++){ if (arr1[i].id === arr2[j].id) { var aw = Object.assign({}, arr1[i], arr2[j]); arr3.push(aw); } } }