I'm trying to merge/concat 2 objects, such a way that currently i have:
var mergeObj = {};
var obj1 = { name: 'abd', id: 5454756, color: 'red' }
var obj2 = { name: 'abc1', id:387589, color: 'blue'}
Now if I merge it should be:
Object {obj1: Object, obj2: Object}
However I tried the following:
mergeObj = obj1.merge(obj2);
and it merges to one object, which is not what i'm looking for. I want to merge in such a way that the final object will have 2 fields: obj1
and obj2
.
Ex:
is it possible?? Any ideas?
thanks~