{"ScriptPreparationCode":null,"TestCases":[{"Name":"Using Object.assign","Code":"const firstObject = {}\r\nconst secondObject = {}\r\n\r\nfor(let i = 1; i \u003C 1000; i\u002B\u002B) firstObject[i] = Math.random();\r\nfor(let i = 1; i \u003C 1000; i\u002B\u002B) secondObject[i] = firstObject[i];\r\n\r\nlet rnd = Math.floor(Math.random() * 1000);\r\nsecondObject[rnd] = Math.random();\r\n\r\nconst finalObject = Object.assign(firstObject, secondObject);\r\n\r\nconsole.log(\u0022first\u0022, firstObject)\r\nconsole.log(\u0022second\u0022, secondObject)\r\nconsole.log(\u0022final\u0022, finalObject)","IsDeferred":false},{"Name":"Using the spread operator","Code":"const firstObject = {}\r\nconst secondObject = {}\r\n\r\nfor(let i = 1; i \u003C 1000; i\u002B\u002B) firstObject[i] = Math.random();\r\nfor(let i = 1; i \u003C 1000; i\u002B\u002B) secondObject[i] = firstObject[i];\r\n\r\nlet rnd = Math.floor(Math.random() * 1000);\r\nsecondObject[rnd] = Math.random();\r\n\r\nconst finalObject = {\r\n\t...firstObject,\r\n \t...secondObject\r\n};\r\n\r\nconsole.log(\u0022first\u0022, firstObject)\r\nconsole.log(\u0022second\u0022, secondObject)\r\nconsole.log(\u0022final\u0022, finalObject)","IsDeferred":false},{"Name":"Using Object.assign (known change)","Code":"const firstObject = {}\r\nconst secondObject = {}\r\n\r\nfor(let i = 1; i \u003C 1000; i\u002B\u002B) firstObject[i] = Math.random();\r\nfor(let i = 1; i \u003C 1000; i\u002B\u002B) secondObject[i] = firstObject[i];\r\n\r\nlet rnd = Math.floor(Math.random() * 1000);\r\nsecondObject[rnd] = Math.random();\r\n\r\nlet diff = {}\r\ndiff[rnd] = secondObject[rnd];\r\n\r\nconst finalObject = Object.assign(firstObject, diff);\r\n\r\nconsole.log(\u0022first\u0022, firstObject)\r\nconsole.log(\u0022second\u0022, secondObject)\r\nconsole.log(\u0022final\u0022, finalObject)","IsDeferred":false},{"Name":"Using the spread operator (known change)","Code":"const firstObject = {}\r\nconst secondObject = {}\r\n\r\nfor(let i = 1; i \u003C 1000; i\u002B\u002B) firstObject[i] = Math.random();\r\nfor(let i = 1; i \u003C 1000; i\u002B\u002B) secondObject[i] = firstObject[i];\r\n\r\nlet rnd = Math.floor(Math.random() * 1000);\r\nsecondObject[rnd] = Math.random();\r\n\r\nlet diff = {}\r\ndiff[rnd] = secondObject[rnd];\r\n\r\nconst finalObject = {\r\n\t...firstObject,\r\n \t...diff\r\n};\r\n\r\nconsole.log(\u0022first\u0022, firstObject)\r\nconsole.log(\u0022second\u0022, secondObject)\r\nconsole.log(\u0022final\u0022, finalObject)","IsDeferred":false},{"Name":"Using Object.assign (filtered)","Code":"const firstObject = {}\r\nconst secondObject = {}\r\n\r\nfor(let i = 1; i \u003C 1000; i\u002B\u002B) firstObject[i] = Math.random();\r\nfor(let i = 1; i \u003C 1000; i\u002B\u002B) secondObject[i] = firstObject[i];\r\n\r\nlet rnd = Math.floor(Math.random() * 1000);\r\nsecondObject[rnd] = Math.random();\r\n\r\nlet diff = Object.entries(secondObject).filter((value, key) =\u003E key == rnd)\r\ndiff = Object.fromEntries(diff)\r\n\r\nconst finalObject = Object.assign(firstObject, diff);\r\n\r\nconsole.log(\u0022first\u0022, firstObject)\r\nconsole.log(\u0022second\u0022, secondObject)\r\nconsole.log(\u0022final\u0022, finalObject)","IsDeferred":false},{"Name":"Using the spread operator (filter)","Code":"const firstObject = {}\r\nconst secondObject = {}\r\n\r\nfor(let i = 1; i \u003C 1000; i\u002B\u002B) firstObject[i] = Math.random();\r\nfor(let i = 1; i \u003C 1000; i\u002B\u002B) secondObject[i] = firstObject[i];\r\n\r\nlet rnd = Math.floor(Math.random() * 1000);\r\nsecondObject[rnd] = Math.random();\r\n\r\nlet diff = Object.entries(secondObject).filter((value, key) =\u003E key == rnd)\r\ndiff = Object.fromEntries(diff)\r\n\r\nconst finalObject = {\r\n\t...firstObject,\r\n \t...diff\r\n};\r\n\r\nconsole.log(\u0022first\u0022, firstObject)\r\nconsole.log(\u0022second\u0022, secondObject)\r\nconsole.log(\u0022final\u0022, finalObject)","IsDeferred":false}]}