{"ScriptPreparationCode":null,"TestCases":[{"Name":"set with destructuring","Code":"const teachers = [{id: \u0027A\u0027}, {id: \u0027B\u0027}, {id: \u0027C\u0027}, {id: \u0027F\u0027}, {id: \u0027H\u0027}, {id: \u0027I\u0027}];\r\nconst admins = [{id: \u0027A\u0027}, {id: \u0027C\u0027}, {id: \u0027D\u0027}, {id: \u0027E\u0027}, {id: \u0027F\u0027}, {id: \u0027G\u0027}]; \r\n\r\nconst ids = new Set(teachers.map(item =\u003E item.id));\r\nconst merged = [...teachers, ...admins.filter(item =\u003E !ids.has(item.id))];","IsDeferred":false},{"Name":"map with push","Code":"const users = [{id: \u0027A\u0027}, {id: \u0027B\u0027}, {id: \u0027C\u0027}, {id: \u0027F\u0027}, {id: \u0027H\u0027}, {id: \u0027I\u0027}];\r\nconst addendUsers = [{id: \u0027A\u0027}, {id: \u0027C\u0027}, {id: \u0027D\u0027}, {id: \u0027E\u0027}, {id: \u0027F\u0027}, {id: \u0027G\u0027}]; \r\nconst combinedUsersMap = {};\r\nconst combinedUsers = [];\r\n\r\nusers.forEach(user =\u003E {\r\n if (!combinedUsersMap[user.id]) {\r\n combinedUsersMap[user.id] = true;\r\n combinedUsers.push(user);\r\n }\r\n});\r\n\r\naddendUsers.forEach(addendUser =\u003E {\r\n if (!combinedUsersMap[addendUser.id]) {\r\n combinedUsersMap[addendUser.id] = true;\r\n combinedUsers.push(addendUser);\r\n }\r\n});","IsDeferred":false}]}