The jQuery.extend() function is used to merge the contents of one or more objects into the target object.
grammar
$.extend( target [, object1 ] [, objectN ] )
Indicates whether the merge is deep
$.extend( [deep ], target, object1 [, objectN ] )
Note: Passing false for the first parameter is not supported.
Deep copy: The deep copy code sets the first argument of the extend function to true: (recursive copy of the object referenced by the original object property) var newObject = $.extend(true, {},oldObject);
Shallow copy: the first argument is not passed in the extend function of the shallow copy code, the default is false (only copy of the original object reference) var newObject = $.extend({}, oldObject);