What is difference between creating object using Object.create() and Object.assign()?
Let’s compare obj1 and obj2 in this code: var target1 = {}, target2 = {}; var obj1 = Object.create(target1, {myProp: {value: 1}}); var obj2 = Object.assign(target2, {myProp: 1}); Prototypical chain Object.create creates a new object with the specified [[Prototype]], and Object.assign assigns the properties directly on the specified object: obj1 !== target1; obj2 === target2; … Read more