{"ScriptPreparationCode":null,"TestCases":[{"Name":"Reduce","Code":"const people = [\r\n { id: 1, name: \u0022Aaron\u0022 },\r\n { id: 2, name: \u0022Amy\u0022 },\r\n { id: 3, name: \u0022Andy\u0022 },\r\n { id: 4, name: \u0022Arnaud\u0022 },\r\n];\r\n\r\nconst reduced = people.reduce((acc, curr) =\u003E {\r\n const { id, ...rest } = curr;\r\n acc[id] = {\r\n ...rest,\r\n };\r\n return acc;\r\n}, {});\r\n \r\n","IsDeferred":false},{"Name":"Map\u002BReduce","Code":"const people = [\r\n { id: 1, name: \u0022Aaron\u0022 },\r\n { id: 2, name: \u0022Amy\u0022 },\r\n { id: 3, name: \u0022Andy\u0022 },\r\n { id: 4, name: \u0022Arnaud\u0022 },\r\n];\r\n\r\nconst reduced = people\r\n .map((p) =\u003E {\r\n const { id, ...rest } = p;\r\n return {\r\n [p.id]: rest,\r\n };\r\n })\r\n .reduce((acc, curr) =\u003E Object.assign(acc, curr), {});","IsDeferred":false}]}