Cloning Javascript Objects
I have found a way to do this with jQuery: // Shallow copy var newObject = jQuery.extend({}, oldObject); // Deep copy var newObject = jQuery.extend(true, {}, oldObject); More information can be found in the jQuery documentation. Why would you need it ? Check this example: var obj1 = {lol : 1}, obj2 = obj1;… Read More »