If you are looking at cloning an object in JQuery , you can do that using the jQuery’s extend method . You can perform the shallow copy or deep copy by setting the parameters.
Below is a sample code snippet demonstrating how to clone an object in JQuery
How to Clone an Object in JQuery ?
var ClonedObject = jQuery.extend({}, ObjectToBeCloned);
The above method performs the shallow copy .
You can set the first parameter of the extend to true to make it a deep copy.
1 Comment