{"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\nfunction recursiveDeepCopy(o) {\r\n var newO,\r\n i;\r\n \r\n if (typeof o !== \u0027object\u0027) {\r\n return o;\r\n }\r\n if (!o) {\r\n return o;\r\n }\r\n \r\n if (\u0027[object Array]\u0027 === Object.prototype.toString.apply(o)) {\r\n newO = [];\r\n for (i = 0; i \u003C o.length; i \u002B= 1) {\r\n newO[i] = recursiveDeepCopy(o[i]);\r\n }\r\n return newO;\r\n }\r\n \r\n newO = {};\r\n for (i in o) {\r\n if (o.hasOwnProperty(i)) {\r\n newO[i] = recursiveDeepCopy(o[i]);\r\n }\r\n }\r\n return newO;\r\n }","TestCases":[{"Name":"Lodash cloneDeep","Code":"myCopy = _.cloneDeep(MyObject);","IsDeferred":false},{"Name":"Native structuredClone","Code":"myCopy = structuredClone(MyObject);","IsDeferred":false},{"Name":"recursiveDeepCopy","Code":"myCopy = recursiveDeepCopy(MyObject);","IsDeferred":false},{"Name":"Json Clone","Code":"myCopy = JSON.parse(JSON.stringify(MyObject));","IsDeferred":false},{"Name":"Fast Copy","Code":"myCopy = fastCopy(MyObject);","IsDeferred":false},{"Name":"chatGptDeepClone","Code":"function chatGptDeepClone(obj) {\r\n if (obj === null || typeof obj !== \u0027object\u0027) {\r\n return obj;\r\n }\r\n\r\n let clone = Array.isArray(obj) ? [] : {};\r\n\r\n for (let key in obj) {\r\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n clone[key] = chatGptDeepClone(obj[key]);\r\n }\r\n }\r\n\r\n return clone;\r\n}\r\n\r\nmyCopy = chatGptDeepClone(MyObject);","IsDeferred":false}]}