Ho can I convert this :
var arr = [{"1":["34"]},{"2":["32","31","30"]},{"3":["29","28","27","26"]}]
to this:
{"1":["34"],"2":["32","31","30"],"3":["29","28","27","26"]}
Is there a function in jQuery to do it ?
Ho can I convert this :
var arr = [{"1":["34"]},{"2":["32","31","30"]},{"3":["29","28","27","26"]}]
to this:
{"1":["34"],"2":["32","31","30"],"3":["29","28","27","26"]}
Is there a function in jQuery to do it ?
 
    
    You could use Object.assign with spread syntax ....
var array = [{ 1: ["34"] }, { 2: ["32", "31", "30"] }, { 3: ["29", "28", "27", "26"] }],
    object = Object.assign({}, ...array);
    
console.log(object) 
    
    Or you could do it in "old style":
var src = [{"1":["34"]},{"2":["32","31","30"]},
      {"3":["29","28","27","26"]}], trg = {};
src.forEach((e)=>{for(var p in e) trg[p]=e[p];});
 
    
     arr.reduce((obj, arrayElem) => Object.assign(obj, arrayElem), {})
Just reduce the array by assigning all Objects together. Or:
 Object.assign({}, ...arr)
