{"ScriptPreparationCode":"var deepClone1 = function(obj) {\r\n if (obj === null || typeof obj !== \u0027object\u0027) {\r\n return obj;\r\n }\r\n var clone = Object.assign({}, obj);\r\n Object.keys(clone).forEach(function(key) {\r\n clone[key] = deepClone1(clone[key]);\r\n });\r\n return clone;\r\n}\r\n\r\nvar deepClone2 = function(obj) {\r\n if (obj === null || typeof obj !== \u0027object\u0027) {\r\n return obj;\r\n }\r\n var clone = Object.assign({}, obj);\r\n for (var key in clone) {\r\n clone[key] = deepClone2(clone[key]);\r\n }\r\n return clone;\r\n}\r\n\r\nvar isObject = function(obj) {\r\n return typeof obj === \u0027object\u0027 \u0026\u0026 obj !== null;\r\n}\r\n\r\nvar deepClone3 = function(obj) {\r\n if (!isObject(obj)) {\r\n return obj;\r\n }\r\n var clone = Object.assign({}, obj);\r\n for (var key in clone) {\r\n clone[key] = deepClone3(clone[key]);\r\n }\r\n return clone;\r\n}\r\n\r\nvar deepClone4 = function(obj) {\r\n if (obj === null || typeof obj !== \u0027object\u0027) {\r\n return obj;\r\n }\r\n \r\n let clone = {...obj}\r\n for (const key in clone) {\r\n clone[key] = deepClone4(clone[key])\r\n }\r\n return clone\r\n}\r\n\r\nvar testData = {\r\n name: \u0027John\u0027,\r\n age: 30,\r\n address: {\r\n street: \u0027123 Main St\u0027,\r\n zip: 12345\r\n },\r\n hobbies: [\u0027reading\u0027, \u0027swimming\u0027, \u0027hiking\u0027],\r\n friends: [\r\n { name: \u0027Jane\u0027, age: 25 },\r\n { name: \u0027Bob\u0027, age: 32 },\r\n { name: \u0027Alice\u0027, age: 27 }\r\n ],\r\n job: {\r\n salary: 100000,\r\n benefits: [\u0027health insurance\u0027, \u0027401k\u0027, \u0027stock options\u0027]\r\n }\r\n};\r\n","TestCases":[{"Name":"DeepClone1","Code":"const r = deepClone1(testData)","IsDeferred":false},{"Name":"deepClone2","Code":"const r = deepClone2(testData)","IsDeferred":false},{"Name":"deepClone3","Code":"const r = deepClone3(testData)","IsDeferred":false},{"Name":"deepClone4","Code":"const r = deepClone4(testData)","IsDeferred":false},{"Name":"structuredClone","Code":"const r = structuredClone(testData)","IsDeferred":false},{"Name":"JSON","Code":"const r = JSON.parse(JSON.stringify(testData))","IsDeferred":false}]}