{"ScriptPreparationCode":"function getRandomKey(length = 5) {\r\n const characters = \u0027ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\u0027;\r\n let result = \u0027\u0027;\r\n for (let i = 0; i \u003C length; i\u002B\u002B) {\r\n result \u002B= characters.charAt(\r\n Math.floor(Math.random() * characters.length),\r\n );\r\n }\r\n return result;\r\n}\r\n\r\nfunction getRandomValue() {\r\n const types = [\r\n () =\u003E Math.random().toString(36).substring(2, 15), // Random string\r\n () =\u003E Math.floor(Math.random() * 1000), // Random number\r\n () =\u003E Math.random() \u003C 0.5, // Random boolean\r\n () =\u003E String.fromCharCode(33 \u002B Math.floor(Math.random() * 94)), // Random symbol\r\n () =\u003E undefined, // undefined\r\n () =\u003E null, // null\r\n () =\u003E (Math.random() \u003C 0.5 ? Symbol(\u0027aSymbol\u0027) : Symbol()), // Random Symbol\r\n () =\u003E \u0060${Math.floor(Math.random() * 10 ** 15)}n\u0060, // Random BigInt as a string (Note: This won\u0027t truly be a BigInt type due to limitations)\r\n ];\r\n return types[Math.floor(Math.random() * types.length)]();\r\n}","TestCases":[{"Name":"Spread Syntax","Code":"const randomObject = {};\r\nconst numberOfKeys = 10000;\r\n\r\nfor (let i = 0; i \u003C numberOfKeys; i\u002B\u002B) {\r\n randomObject[getRandomKey()] = getRandomValue();\r\n}\r\nconst newObj = {...randomObject};","IsDeferred":false},{"Name":"Object.assign","Code":"const randomObject = {};\r\nconst numberOfKeys = 10000;\r\n\r\nfor (let i = 0; i \u003C numberOfKeys; i\u002B\u002B) {\r\n randomObject[getRandomKey()] = getRandomValue();\r\n}\r\nconst newObj = Object.assign({}, randomObject);","IsDeferred":false},{"Name":"Object.fromEntries and Object.entries:","Code":"const randomObject = {};\r\nconst numberOfKeys = 10000;\r\n\r\nfor (let i = 0; i \u003C numberOfKeys; i\u002B\u002B) {\r\n randomObject[getRandomKey()] = getRandomValue();\r\n}\r\nconst newObj = Object.fromEntries(Object.entries(randomObject));","IsDeferred":false},{"Name":"JSON","Code":"const randomObject = {};\r\nconst numberOfKeys = 10000;\r\n\r\nfor (let i = 0; i \u003C numberOfKeys; i\u002B\u002B) {\r\n randomObject[getRandomKey()] = getRandomValue();\r\n}\r\nconst newObj = JSON.parse(JSON.stringify(randomObject));","IsDeferred":false},{"Name":"Reference Assignment","Code":"const randomObject = {};\r\nconst numberOfKeys = 10000;\r\n\r\nfor (let i = 0; i \u003C numberOfKeys; i\u002B\u002B) {\r\n randomObject[getRandomKey()] = getRandomValue();\r\n}\r\nconst newObj = randomObject;","IsDeferred":false},{"Name":"Deep copy using a recursive function","Code":"const randomObject = {};\r\nconst numberOfKeys = 10000;\r\n\r\nfor (let i = 0; i \u003C numberOfKeys; i\u002B\u002B) {\r\n randomObject[getRandomKey()] = getRandomValue();\r\n}\r\nfunction deepCopy(obj) {\r\n if (obj === null) return null;\r\n if (typeof obj !== \u0022object\u0022) return obj;\r\n if (obj instanceof Array) return obj.map(deepCopy);\r\n const newObj = {};\r\n for (let key in obj) {\r\n newObj[key] = deepCopy(obj[key]);\r\n }\r\n return newObj;\r\n}\r\nconst newObj = deepCopy(randomObject);","IsDeferred":false}]}