{"ScriptPreparationCode":"const sections = [\r\n {\r\n id: \u0027what\u0027,\r\n name: \u0027what\u0027,\r\n items: [\r\n {\r\n id: \u0027id\u0027,\r\n name: \u0027Id\u0027\r\n },\r\n {\r\n id: \u0027yo\u0027,\r\n name: \u0027Date\u0027\r\n }\r\n ]\r\n },\r\n {\r\n id: \u0027hey\u0027,\r\n name: \u0027hey\u0027,\r\n items: []\r\n },\r\n {\r\n id: \u0027ha\u0027,\r\n name: \u0027ha\u0027,\r\n items: [\r\n {\r\n id: \u0027good\u0027,\r\n name: \u0027good\u0027\r\n }\r\n ]\r\n }\r\n ];\r\n\r\n var arr = [...sections];\r\n Array(10000)\r\n .fill(0)\r\n .forEach((i) =\u003E {\r\n arr = arr.concat(sections);\r\n });","TestCases":[{"Name":"reduce with spread","Code":"const case1 = arr.reduce(\r\n (acc, cur, i) =\u003E [...acc, ...cur.items.map((item) =\u003E item.id \u002B i)],\r\n []\r\n );","IsDeferred":false},{"Name":"reduce with concat","Code":"const case2 = arr.reduce((acc, cur, i) =\u003E acc.concat(cur.items.map((item) =\u003E item.id \u002B i)), []);","IsDeferred":false},{"Name":"flat","Code":"const case3 = arr.flatMap((x, i) =\u003E x.items.map((item) =\u003E item.id \u002B i));","IsDeferred":false},{"Name":"foreach","Code":"const case4 = [];\r\n arr.forEach((section, i) =\u003E {\r\n section.items.forEach((item) =\u003E {\r\n case4.push(item.id \u002B i);\r\n });\r\n });","IsDeferred":false}]}