Say I have two arrays of objects, like so:
var arr1 = [{name: \'Jay\'}, {name: \'Bob\'}]; var arr2 = [{age: 22}, {age: 30}];
I want a combined
the most trivial solution is (in compare to any util lib like underscore.js or similar). pros of it is it works without any dependency.
var result = []; for(var i = 0; i < arr1.length; i+= 1) { item = {}; item.name = arr1[i].name; item.age = arr2[i].age; result.push(item); }