{"ScriptPreparationCode":null,"TestCases":[{"Name":"Test2","Code":"const objects = [\r\n { id: 1, name: \u0022Test 1\u0022, object_type: 1 },\r\n { id: 2, name: \u0022Test 2\u0022, object_type: 1 },\r\n { id: 3, name: \u0022Test 3\u0022, object_type: 2 },\r\n { id: 4, name: \u0022Test 4\u0022, object_type: 3 },\r\n ]\r\n const object_types = [];\r\n for(let i = 1; i \u003C 1000000; i\u002B\u002B) {\r\n object_types.push({id: i, class: Math.random() \u003E 0.5 ? \u0022\u0423\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0430\u0022 : \u0022\u041F\u043E\u0440\u0442\u044B\u0022 });\r\n }\r\n const className = \u0022\u0423\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0430\u0022; \r\nfunction result (objects, object_types, className) {\r\n const arr = []\r\n for (let i = 0; i \u003C object_types.length; i\u002B\u002B) {\r\n if (object_types.class === className) {\r\n arr.push(object_types.id)\r\n }\r\n }\r\n const filterObjectForClass = new Set(arr);\r\n \r\n let result = \u0027\u0027; \r\n objects.forEach(item =\u003E {\r\n if (filterObjectForClass.has(item.object_type)) {\r\n result \u002B= item.name \u002B \u0027,\u0027;\r\n }\r\n })\r\n \r\n return result;\r\n }\r\n result(objects,object_types,className);","IsDeferred":false},{"Name":"Test3","Code":"const objects = [\r\n { id: 1, name: \u0022Test 1\u0022, object_type: 1 },\r\n { id: 2, name: \u0022Test 2\u0022, object_type: 1 },\r\n { id: 3, name: \u0022Test 3\u0022, object_type: 2 },\r\n { id: 4, name: \u0022Test 4\u0022, object_type: 3 },\r\n ]\r\n const object_types = [];\r\n for(let i = 1; i \u003C 1000000; i\u002B\u002B) {\r\n object_types.push({id: i, class: Math.random() \u003E 0.5 ? \u0022\u0423\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0430\u0022 : \u0022\u041F\u043E\u0440\u0442\u044B\u0022 });\r\n }\r\n const className = \u0022\u0423\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0430\u0022; \r\nfunction result (objects, object_types, className) {\r\n const filterObjectForClass = object_types\r\n .filter(item =\u003E item.class === className)\r\n \r\n const res = objects\r\n .filter(item =\u003E {\r\n const matchElem = filterObjectForClass.find(elem =\u003E elem.id === item.object_type);\r\n return matchElem \u0026\u0026 item.object_type === matchElem.id\r\n })\r\n .map(item =\u003E item.name)\r\n .join()\r\n return res;\r\n }\r\nresult(objects,object_types,className);","IsDeferred":false}]}