You can add some object properties just like this:
obj = {a : "1", b : "2"}; myObj = {c: "3", d : "4"}; myObj.a = obj.a; myObj.b = obj.b;
Update
In this case, simply do the following:
for(var prop in obj) myObj[prop] = obj[prop];
And to filter out unwanted properties inside the loop body, you can also do this:
for (var prop in obj) { if (obj.hasOwnProperty(prop)) { myObj[prop] = obj[prop]; } }
source share