dst = { "a" : 1}
src = { "edf" : {"zyx" : "right"}}
Object.assign(dst, src)
src.edf.zyx = "wrong"
console.log(dst["edf"]["zyx"])
I expect to see 'right'
as the output but it prints 'wrong'
.
It means, Object.assign
has not done a deep copy of complex objects from source to destination. How can i do deep copy?
Note: i am aware of lodash.deepClone
, but i am trying to avoid outside frameworks