Enter the data into the system
[
{
“Product”: “Notebook”,
“Action”: “Add”
},
{
“Product”: “Pen”,
“Action”: “Sell”
},
{
“Product”: “Pen”,
“Action”: “Buy”
},
{
“Product”: “Pencil”,
“Action”: “Sell”
},
{
“Product”: “Pencil”,
“Action”: “Buy”
}
]
Desired Result:
[
{
“Product”: “Pen”,
“sellCount”: 1,
“buyCount: 1
},
{
“Product”: “Pencil”,
“sellCount”: 1,
“buyCount: 1
}
]
Utilized rxjs functionalities such as reduce and filter.