{"ScriptPreparationCode":"function deepCopy(obj) {\r\n var copy;\r\n\r\n // Handle the 3 simple types, and null or undefined\r\n if (null == obj || \u0022object\u0022 != typeof obj) return obj;\r\n\r\n // Handle Date\r\n if (obj instanceof Date) {\r\n copy = new Date();\r\n copy.setTime(obj.getTime());\r\n return copy;\r\n }\r\n\r\n // Handle Array\r\n if (obj instanceof Array) {\r\n copy = [];\r\n for (var i = 0, len = obj.length; i \u003C len; i\u002B\u002B) {\r\n copy[i] = deepCopy(obj[i]);\r\n }\r\n return copy;\r\n }\r\n\r\n // Handle Object\r\n if (obj instanceof Object) {\r\n copy = {};\r\n for (var attr in obj) {\r\n if (obj.hasOwnProperty(attr)) copy[attr] = deepCopy(obj[attr]);\r\n }\r\n return copy;\r\n }\r\n\r\n throw new Error(\u0022Unable to copy obj! Its type isn\u0027t supported.\u0022);\r\n};\r\n\r\nfunction generate_data() {\r\n let data = {\r\n \u0027prices\u0027: [],\r\n \u0027other_prices\u0027 : [],\r\n \u0027my object\u0027: [\r\n {\u0027object a\u0027: \u0027object object\u0027},\r\n {\u0027object b\u0027: \u0027object object\u0027}, \r\n {\u0027object c\u0027: \u0027object object\u0027, \u0027objectd\u0027: 36}, \r\n 5\r\n ]\r\n };\r\n\r\n // Helper function to generate random product names\r\n function generateProductName() {\r\n const products = [\u0027Laptop\u0027, \u0027Phone\u0027, \u0027Tablet\u0027, \u0027Headphone\u0027, \u0027Speaker\u0027, \u0027Monitor\u0027, \u0027Keyboard\u0027, \u0027Mouse\u0027, \u0027Smartwatch\u0027, \u0027Camera\u0027];\r\n const adjectives = [\u0027Super\u0027, \u0027Ultra\u0027, \u0027Pro\u0027, \u0027Max\u0027, \u0027Plus\u0027, \u0027Lite\u0027, \u0027Mini\u0027, \u0027Advanced\u0027, \u0027Portable\u0027, \u0027Wireless\u0027];\r\n const randomProduct = products[Math.floor(Math.random() * products.length)];\r\n const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)];\r\n return \u0060${randomAdjective} ${randomProduct}\u0060;\r\n }\r\n\r\n // Helper function to generate random prices\r\n function generatePrice() {\r\n return (Math.random() * 1000).toFixed(2); // Random price between 0 and 1000 with 2 decimal places\r\n }\r\n\r\n // Generate 6000 product name and price entries\r\n for (let i = 0; i \u003C 60000; i\u002B\u002B) {\r\n const product = generateProductName();\r\n const price = generatePrice();\r\n data[\u0027prices\u0027].push({ \u0027product\u0027: product, \u0027price\u0027: parseFloat(price) });\r\n }\r\n for (let i = 0; i \u003C 60000; i\u002B\u002B) {\r\n const product = generateProductName();\r\n const price = generatePrice();\r\n data[\u0027other_prices\u0027].push({ \u0027product\u0027: product, \u0027price\u0027: parseFloat(price) });\r\n }\r\n\r\n return data;\r\n};\r\n\r\nvar data = generate_data();","TestCases":[{"Name":"JSON copy","Code":"a = JSON.parse(JSON.stringify(data));","IsDeferred":false},{"Name":"Deep copy","Code":"a = deepCopy(data);","IsDeferred":false}]}