Combining two objects in JavaScript

1 · Milosz Piechocki · Jan. 11, 2016, 8:38 p.m.
One thing that I have to do rather often when writing JavaScript code is to combine properties from two objects into a single object. UPDATE: This article was originally called Combining two objects in lodash. I’ve updated it to cover more ways of combining objects in JavaScript For example, given these two objects:1234567const a = { name: "John", age: 23};const b = { job: "Analyst"};…what can be done to avoid copying properties manually?12345const c = { name: a.name, age: a.age, job: b.jo...