{"ScriptPreparationCode":null,"TestCases":[{"Name":"spread ...","Code":"const arr1 = [ true, 1, \u0022true\u0022, [], {}, function () {} ];\r\n\r\n// Deep copies: true, 1, \u0022true\u0022\r\n// Shallow copies: [], {}, function () {}\r\nconst arr2 = [ ...arr1 ];","IsDeferred":false},{"Name":"slice()","Code":"const arr1 = [ true, 1, \u0022true\u0022, [], {}, function () {} ];\r\n\r\n// Deep copies: true, 1, \u0022true\u0022\r\n// Shallow copies: [], {}, function () {}\r\nconst arr2 = arr1.slice();","IsDeferred":false},{"Name":"splice(0)","Code":"const arr1 = [ true, 1, \u0022true\u0022, [], {}, function () {} ];\r\n\r\n// Deep copies: true, 1, \u0022true\u0022\r\n// Shallow copies: [], {}, function () {}\r\nconst arr2 = arr1.splice(0);","IsDeferred":false},{"Name":"concat()","Code":"const arr1 = [ true, 1, \u0022true\u0022, [], {}, function () {} ];\r\n\r\n// Deep copies: true, 1, \u0022true\u0022\r\n// Shallow copies: [], {}, function () {}\r\nconst arr2 = arr1.concat();","IsDeferred":false},{"Name":"JSON.parse(JSON.stringify())","Code":"const arr1 = [ true, 1, \u0022true\u0022, [], {}, function () {} ];\r\n\r\n// Deep copies: true, 1, \u0022true\u0022, [], {}\r\n// Shallow copies: function () {}\r\nconst arr2 = JSON.parse(JSON.stringify(arr1));","IsDeferred":false},{"Name":"Custom function","Code":"function copy(aObject) {\r\n // Prevent undefined objects\r\n // if (!aObject) return aObject;\r\n\r\n let bObject = Array.isArray(aObject) ? [] : {};\r\n\r\n let value;\r\n for (const key in aObject) {\r\n\r\n // Prevent self-references to parent object\r\n // if (Object.is(aObject[key], aObject)) continue;\r\n\r\n value = aObject[key];\r\n\r\n bObject[key] = (typeof value === \u0022object\u0022) ? copy(value) : value;\r\n }\r\n\r\n return bObject;\r\n}\r\n\r\nconst arr1 = [ true, 1, \u0022true\u0022, [], {}, function () {} ];\r\n\r\n// Deep copies: true, 1, \u0022true\u0022, [], {}, function () {}\r\nconst arr2 = copy(arr1);","IsDeferred":false},{"Name":"Lodash.cloneDeep()","Code":"const arr1 = [ true, 1, \u0022true\u0022, [], {}, function () {} ];\r\n\r\n// Deep copies: true, 1, \u0022true\u0022, [], {}, function () {}\r\nconst arr2 = _.cloneDeep(arr1);","IsDeferred":false},{"Name":"structuredClone","Code":"const arr1 = [ true, 1, \u0022true\u0022, [], {} ];\r\n\r\n// Deep copies: true, 1, \u0022true\u0022, [], {}, function () {}\r\nconst arr2 = structuredClone(arr1)","IsDeferred":false}]}