1×
Become a member
to unlock all features

Create egghead account to access 1,000+ tutorials and resources from expert developers.

Create account
Autoplay

    Shallow Merge Two Objects in JavaScript

    javascriptJavaScript

    This lesson looks at three methods that can be used to shallow merge two objects in javascript: Object.assign, both with mutating the original object and without mutation, and the spread operator.

    It also covers the potential danger of doing a shallow merge instead of a deep merge, by showing an example of merging two objects that have objects as values, instead of simple strings.