I want to have an immutable source array of an object and expand it, but it seems the code below did the correct result. obj3 became an object instead of an array of an object. I even tried to expand lodash.
var obj1 = [{
abc: 'abc value'
}, {
def: 'def value'
}];
var obj2 = {
def: 'new def value'
};
var obj3 = Object.assign({},obj1,obj2);
https://jsbin.com/bawadeqicu/edit?html,js,output
Out of my desire
obj1: [{"abc":"abc value"},{"def":"def value"}]
obj3: [{"abc":"abc value"},{"def":"new def value"}]
source
share