I'm using Object.assign wrong?
I tought it will replace the values, but actually it overwrites them...
For example the 'PEACH' property will be deleted after being assigned.
Isn't it strange? How would you solve this?
Let's save PEACH
var result = Object.assign({
'first_level': {
'second_level': {
'changeme': 'not changed bruh',
'PEACH': 'PLEASE SAVE ME!'
}
},
'hehe' : 'I will stay here'
}, {
'first_level': {
'second_level': {
'change': 'Changed B]',
'addme': 'Extra prop'
}
},
'huh' : 'I want to join the party'
});
document.body.innerHTML = '<pre>'+JSON.stringify(result, null, 2)+'</pre>';