Object.concat

Object.concat

Object.concat

Function

Merge one or more objects into a new object.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
sourceNObjectNoNoneThe object to merge; non-object arguments are ignored.

Return value

TypeDescription
ObjectReturns the new merged object.

Return object fields

The returned object first copies the fields of the current object, and then copies the fields of each source object in parameter order; fields with the same name are overwritten by the object passed in later. No fields are written to non-object parameters.

Example

Notes

  • The key with the same name passed in later will overwrite the previous value.
  • The original object will not be modified.