{"ScriptPreparationCode":null,"TestCases":[{"Name":"Using the spread operator","Code":"const firstObject = { sampleData: \u0027Hello world\u0027 }\r\nconst secondObject = { moreData: \u0027foo bar\u0027 }\r\nconst finalObject = {\r\n\t...firstObject,\r\n \t...secondObject\r\n};","IsDeferred":false},{"Name":"Using Object.assign","Code":"const firstObject = { sampleData: \u0027Hello world\u0027 }\r\nconst secondObject = { moreData: \u0027foo bar\u0027 }\r\nconst finalObject = Object.assign({}, firstObject, secondObject);","IsDeferred":false},{"Name":"Using For-In loop","Code":"const firstObject = { sampleData: \u0027Hello world\u0027 }\r\nconst secondObject = { moreData: \u0027foo bar\u0027 }\r\nconst finalObject = {}\r\nfor (let key in firstObject) {\r\n finalObject[key] = firstObject[key];\r\n}\r\nfor (let key in secondObject) {\r\n finalObject[key] = secondObject[key];\r\n}","IsDeferred":false},{"Name":"Using For-In loop with type checks","Code":"const firstObject = { sampleData: \u0027Hello world\u0027 }\r\nconst secondObject = { moreData: \u0027foo bar\u0027 }\r\nconst finalObject = {}\r\nif (firstObject != null \u0026\u0026 typeof firstObject === \u0027object\u0027) {\r\n for (let key in firstObject) {\r\n if (Object.prototype.hasOwnProperty.call(firstObject, key)) {\r\n finalObject[key] = firstObject[key];\r\n }\r\n }\r\n}\r\n\r\nif (secondObject != null \u0026\u0026 typeof secondObject === \u0027object\u0027) {\r\n for (let key in secondObject) {\r\n if (Object.prototype.hasOwnProperty.call(secondObject, key)) {\r\n finalObject[key] = secondObject[key];\r\n }\r\n }\r\n}","IsDeferred":false}]}