Object.assign()
Object.assign() is a JavaScript method in the Object category. Copies properties from source objects to a target. The syntax is Object.assign(target, ...sources). A typical example: Object.assign({a:1}, {b:2}) // {a:1, b:2}. Its time complexity is O(n), which matters when it runs over large inputs. The TypeScript signature is (target: T, source: U): T & U. A close sibling is Object.keys(), which returns an array of a given object's own enumerable property names. A close sibling is Object.values(), which returns an array of a given object's own enumerable property values. A close sibling is Object.entries(), which returns an array of key/value pairs. A close sibling is Object.create(), which creates a new object with a specified prototype. More about this category: Object methods for object manipulation — keys, values, assign, and more. Related Object methods: Object.keys(), Object.values(), Object.entries(), Object.create(), Object.defineProperty(), Object.defineProperties(), Object.freeze(), Object.seal().