Table of contents
No headings in the article.
Properties in target object are overwritten by properties in the sources if they have the same key.
Alternatively, we can use spread operator.
Must use empty object as first param as it is the target into which every source properties will be copied (set).
Object.assign(target, source1, source2....);
Otherwise the object positioned in target will get mutated like below:
Don't deep clone using object.assign. It can stop mutating first hand object whereas it can allow mutating nested objects like.
Native alternative for deep clone would be JSON.parse.