I'm looking to optimize this response data within my Angular application.
res=[
{ "url": "/page1", "views": 2 },
{ "url": "/page2", "views": 1 },
{ "url": "/page1", "views": 10 },
{ "url": "/page2", "views": 4 },
{ "url": "/page3", "views": 1 },
{ "url": "/page2", "views": 0 },
{ "url": "/page3", "views": 14 },
{ "url": "/page1", "views": 04 },
{ "url": "/page3", "views": 14 },
]
I aim to transform the response into:
res=[
{ "url": "/page1", "views": 104 },
{ "url": "/page2", "views": 104 },
{ "url": "/page3", "views": 104 },
]