{"ScriptPreparationCode":"var MyObject = {\r\n description: \u0027Creates a deep copy of source, which should be an object or an array.\u0027,\r\n myNumber: 123456789,\r\n myBoolean: true,\r\n jayson: {\r\n stringify: \u0027JSON.stringify() method converts a JavaScript value to a JSON string....\u0027,\r\n parse: \u0027JSON.parse() method parses a JSON string...\u0027\r\n }\r\n};\r\n\r\nvar myCopy = null;\r\n\r\nvar isObject = (unknown) =\u003E !!unknown \u0026\u0026 unknown.constructor === Object\r\nvar isArray = (unknown) =\u003E !!unknown \u0026\u0026 unknown.constructor === Array\r\n \r\nvar deepCopy = (obj) =\u003E { \r\n var objCopy = obj\r\n\r\n if (Array.isArray(obj)) {\r\n objCopy = [...obj]\r\n for (var i = 0; i \u003C objCopy.length; i \u002B= 1) {\r\n if (Array.isArray(objCopy[i] || isObject(objCopy[i]))) {\r\n objCopy[i] = deepCopy(objCopy[i])\r\n }\r\n }\r\n return objCopy\r\n }\r\n if (isObject(obj)) {\r\n objCopy = {\r\n ...obj,\r\n }\r\n var keysArray = Object.keys(objCopy)\r\n for (var i = 0; i \u003C keysArray.length; i \u002B= 1) {\r\n if (typeof objCopy[keysArray[i]] === \u0027object\u0027) {\r\n deepCopy(objCopy[keysArray[i]])\r\n }\r\n }\r\n return objCopy\r\n }\r\n return objCopy\r\n}","TestCases":[{"Name":"Lodash cloneDeep","Code":"myCopy = _.cloneDeep(MyObject);","IsDeferred":false},{"Name":"Json clone","Code":"myCopy = JSON.parse(JSON.stringify(MyObject));","IsDeferred":false},{"Name":"DeepCopy ","Code":"myCopy = deepCopy(MyObject);","IsDeferred":false}]}