var arr1 =[{name:"lang",value:"English"},{name:"age",value:"18"}];var arr2 =[{name:"childs",value:'5'},{name:"lang",value:"German"}];Array.prototype.push.apply(arr1,arr2);console.log(arr1);// final merged result will be in arr1
var objArr1 =[{id:"1",fruit:"apple"},{id:"2",fruit:"banana"}];var objArr2 =[{id:"3",fruit:'mango'},{id:"4",fruit:"pear"}];Array.prototype.push.apply(ObjArr1,ObjArr2);console.log(ObjArr1);// final merged result will be in ObjArr1// ObjArr1 => [{id: "1", fruit: "apple"},{id: "2", fruit: "banana"},{id : "3", fruit: 'mango'}, {id: "4", fruit: "pear"}]
var arr1 =[{name:"lang",value:"English"},{name:"age",value:"18"}];var arr2 =[{name:"childs",value:'5'},{name:"lang",value:"German"}];Array.prototype.push.apply(arr1,arr2);console.log(arr1);// final merged result will be in arr1/*
[{"name":"lang","value":"English"},
{"name":"age","value":"18"},
{"name":"childs","value":"5"},
{"name":"lang","value":"German"}]
*/
const arrObj =[{a:1,b:2},{c:3,d:4},{e:5,f:6}];console.log(arrObj.reduce(function(result, current){returnObject.assign(result, current);},{}));// If you prefer arrow functions, you can make it a one-liner ;-)console.log(arrObj.reduce(((r, c)=>Object.assign(r, c)),{}));// Thanks Spen from the comments. You can use the spread operator with assignconsole.log(Object.assign({},...arrObj));Run code snippet