{"ScriptPreparationCode":"const assignments = [{\r\n id: \u00271\u0027,\r\n tasks: [\r\n \u0027article\u0027, \u0027video\u0027, \u0027GO\u0027\r\n ]\r\n },\r\n {\r\n id: \u00272\u0027,\r\n tasks: [\r\n \u0027article\u0027, \u0027video\u0027, \u0027GO\u0027\r\n ]\r\n },\r\n];","TestCases":[{"Name":"flatMap","Code":"const assignments = [{\r\n id: \u00271\u0027,\r\n tasks: [\r\n \u0027article\u0027, \u0027video\u0027, \u0027GO\u0027\r\n ]\r\n },\r\n {\r\n id: \u00272\u0027,\r\n tasks: [\r\n \u0027article\u0027, \u0027video\u0027, \u0027GO\u0027\r\n ]\r\n },\r\n];\r\n\r\nconst test = assignments.flatMap(assignment =\u003E assignment.tasks.map(task =\u003E {\r\n return ({\r\n id: assignment.id,\r\n task\r\n })\r\n}));","IsDeferred":false},{"Name":"reduce","Code":"const assignments = [{\r\n id: \u00271\u0027,\r\n tasks: [\r\n \u0027article\u0027, \u0027video\u0027, \u0027GO\u0027\r\n ]\r\n },\r\n {\r\n id: \u00272\u0027,\r\n tasks: [\r\n \u0027article\u0027, \u0027video\u0027, \u0027GO\u0027\r\n ]\r\n },\r\n];\r\n\r\nconst test = assignments.reduce(\r\n (test, { tasks, id }) =\u003E test\r\n .concat(tasks.map(task =\u003E ({ id, task }))), \r\n []\r\n);","IsDeferred":false}]}