I've got the following array of objects:
let arr = [
{
status: 'Approved',
domain: 'random.com',
refID: '5005w1X4wL7:ref'
},
{
status: 'Approved',
domain: 'random123.com',
refID: '5005w1X4wL7:ref'
},
{
status: 'Approved',
domain: 'helloworld.com',
refID: '5005w1X4wL7'
},
{
status: 'Approved',
domain: 'helloworld123.com',
refID: '5005w1X4wL7'
}
]
Sorry, I am new to coding but I need to sort or filter through this array to find matching refID's and create new array of objects. Please see an example of the output I am looking for:
let newArr = [
{
status: 'Approved',
domain: ['random.com','random123.com'],
refID: '5005w1X4wL7:ref'
},
{
status: 'Approved',
domain: ['hellworld.com','helloworld123.com'],
refID: '5005w1X4wL7'
}
]