Creating ImagesInc_Utilites module
Since a utilities module is a good place to implement our object cloning code, let's create our ImagesInc_Utilites
module as follows:
var ImagesInc_Utilitizes = (function(){ var clone = function clone(deep) { // create an instance of the object var newClonedObj = new this.constructor(); //copy all properties from the original object for (var property in this){ // if deep flag is not set, just do a shallow copy of properties if (!deep){ if(this.hasOwnProperty(property)){ newClonedObj[property] = this[property]; } // to make a deep copy, call the function recursively }else if (typeof this[property] == 'object' && this.hasOwnProperty(property)){ newClonedObj[property] = this[property].clone(deep); }else if(this.hasOwnProperty(property)){ //Just copy properties...