[Solved] How i change array in js get by key [closed]


//perhaps, you probably do it like this :

var result = {}; 
$.each([{id: 1, add_1: "123", add_2: "add1"}, {id: 2, add_1: "456", add_2: "add2"} ], function(i, item ){
        for(var pro in item ){
            result[pro] = result[pro] || [];
            result[pro].push(item[pro]);
        }
})
console.log(result);

2

solved How i change array in js get by key [closed]