{"ScriptPreparationCode":"var firstObject = {\r\n \u0022name\u0022: \u0022John Doe\u0022,\r\n \u0022age\u0022: 30,\r\n \u0022isStudent\u0022: false,\r\n \u0022address\u0022: {\r\n \u0022street\u0022: \u0022123 Main St\u0022,\r\n \u0022city\u0022: \u0022Anytown\u0022,\r\n \u0022zipcode\u0022: \u002212345\u0022\r\n },\r\n \u0022contacts\u0022: [\r\n {\r\n \u0022type\u0022: \u0022email\u0022,\r\n \u0022value\u0022: \u0022john.doe@example.com\u0022\r\n },\r\n {\r\n \u0022type\u0022: \u0022phone\u0022,\r\n \u0022value\u0022: \u0022\u002B1 123-456-7890\u0022\r\n }\r\n ],\r\n \u0022skills\u0022: {\r\n \u0022programming\u0022: [\u0022JavaScript\u0022, \u0022Python\u0022, \u0022Java\u0022],\r\n \u0022design\u0022: [\u0022Photoshop\u0022, \u0022Illustrator\u0022],\r\n \u0022languages\u0022: {\r\n \u0022spoken\u0022: [\u0022English\u0022, \u0022Spanish\u0022],\r\n \u0022written\u0022: [\u0022English\u0022, \u0022French\u0022]\r\n }\r\n },\r\n \u0022isActive\u0022: true,\r\n \u0022projects\u0022: [\r\n {\r\n \u0022name\u0022: \u0022Project A\u0022,\r\n \u0022status\u0022: \u0022completed\u0022,\r\n \u0022team\u0022: [\u0022Alice\u0022, \u0022Bob\u0022]\r\n },\r\n {\r\n \u0022name\u0022: \u0022Project B\u0022,\r\n \u0022status\u0022: \u0022in progress\u0022,\r\n \u0022team\u0022: [\u0022Charlie\u0022, \u0022David\u0022]\r\n }\r\n ]\r\n}\r\n","TestCases":[{"Name":"Using the spread operator","Code":"const finalObject = {...firstObject};","IsDeferred":false},{"Name":"Using Object.assign","Code":"const finalObject = Object.assign(firstObject);","IsDeferred":false},{"Name":"forEach","Code":"const finalObject = {}\r\nObject.keys(firstObject).forEach(key =\u003E {finalObject[key] = firstObject[key] })\r\n","IsDeferred":false},{"Name":"deep clone","Code":"function deepClone(original) {\r\n const cloned = {};\r\n\r\n Object.keys(original).forEach(key =\u003E {\r\n const value = original[key];\r\n\r\n if (typeof value === \u0027object\u0027 \u0026\u0026 value !== null) {\r\n // Recursively clone nested objects\r\n cloned[key] = deepClone(value);\r\n } else {\r\n // Copy non-object values directly\r\n cloned[key] = value;\r\n }\r\n });\r\n\r\n return cloned;\r\n}\r\nconst finalObject = deepClone(firstObject);","IsDeferred":false}]}