{"ScriptPreparationCode":null,"TestCases":[{"Name":"forEach","Code":"const currency = [{ usd: 5 }, { uah: 10 }, { usd: 3 }]; \r\n\r\nconst merge = (data) =\u003E {\r\n const res = {};\r\n\r\n data.forEach((item) =\u003E {\r\n for (let [key, value] of Object.entries(item)) {\r\n !res[key] ? (res[key] = value) : (res[key] \u002B= value);\r\n }\r\n });\r\n return res;\r\n};\r\n\r\nmerge(currency)","IsDeferred":false},{"Name":"Reduce","Code":"const currency = [{ usd: 5 }, { uah: 10 }, { usd: 3 }]; \r\n\r\nconst result = currency.reduce((res, item) =\u003E {\r\n for (const [key, value] of Object.entries(item)) {\r\n !res[key] ? (res[key] = value) : (res[key] = res[key] \u002B value);\r\n }\r\n return res;\r\n}, {});","IsDeferred":false}]}