Object.assign
Object.assign
lets us merge one object's properties into another, replacing values of properties with matching names. We can use this to copy an object's values without altering the existing one.
As you can see, although we have some way of copying an object, we haven't made it immutable, since we were able to set the episode's property to 8. Also, how do we modify the episode property in this case? We do that through the assign call:
Last updated