I have an object literal, a
:
a = {foo: 'foo'};
And I want to get b
, the combination of a
and {bar: 'bar'}
:
b = {foo: 'foo', bar: 'bar'};
How can I do with without writing out all of the properties of a
? i.e:
b = a + {bar: 'bar'};
And no, I do not want to have a be a property itself of b, as shown here:
b = {a: a, bar: 'bar'};