My array looks like below
const arr = [
{
"devices": "delete"
},
{
"devices": "update"
},
{
"devices": "read"
},
{
"alerts":"read"
}
]
I have to change the format as below :
const dict = {
"devices": [
"update",
"read"
],
"alerts": [
"read"
]}
Is there a optimal way to achieve this ?