const reducedData = Object.values(stockEntryReportData.reduce((acc, obj) => { const key = obj.store_id + '-' + obj.date + '-' + obj.user_id; if (!acc[key]) { acc[key] = { ...obj }; } else { acc[key].productCount += obj.productCount; } return acc; }, {})); console.log(reducedData);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter