{"ScriptPreparationCode":"var arr = [\r\n {\r\n uuid:\u0027abcd-efgh\u0027,\r\n total:2\r\n }, {\r\n uuid:\u0027abcd-efgh\u0027,\r\n total:4\r\n }, {\r\n uuid:\u0027ijkl-mnop\u0027,\r\n total:5\r\n },\r\n]\r\n","TestCases":[{"Name":"User A","Code":"const expectedOutput = [...new Set(arr.map(data =\u003E data.uuid))].map(uniqueUUID=\u003E{\r\n return {\r\n uuid: uniqueUUID,\r\n total: (arr.filter(data=\u003Edata.uuid===uniqueUUID)).reduce((a,b)=\u003Ea\u002Bb.total,0)\r\n }\r\n})","IsDeferred":false},{"Name":"Map()","Code":"const mapArr = new Map();\r\n\r\narr.forEach((dtArr)=\u003E{\r\n const target = mapArr.get(dtArr.uuid)\r\n mapArr.set(dtArr.uuid,{\r\n uuid: dtArr.uuid,\r\n total: dtArr.total\u002B(target?.total??0)\r\n })\r\n})\r\nconst res = [...mapArr].map((dtMap)=\u003EdtMap[1])\r\n","IsDeferred":false}]}