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 ValueDescription
StringReturns the resulting string.

Sample

ExampleResultDescription
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.