merge
Modified on Thu, 24 Aug 2023
Description
This method is used to recursively merge own and inherited enumerable string keyed properties of source objects into the destination object. It performs a deep merge of objects, combining their properties.
Syntax
merge(object1, object2)
Returns
Return Value | Description |
---|---|
String | Returns the resulting string. |
Sample
Example | Result | Description |
---|---|---|
merge({ a: { b: { c: 1 } } }, { a: { b: { d: 2 } } }) | { a: { b: { c: 1, d: 2 } } } | Merges the properties of two objects, resulting in a deep merge of their properties. |
To view all Object methods, click here.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article