I am trying to take an array of objects and do 2 things.
1.) Remove objects from the array that are duplicated, create a new array with the names of the items that were duplicates.
Original:
var duplicates = [];
var objects = [
{
name: 'foo',
nums: [1,2]
},
{
name: 'bar',
nums: [3,2]
},
{
name: 'baz',
nums: [1,2]
},
{
name: 'bum',
nums: [2,3]
},
{
name: 'bam',
nums: [1,2]
},
]
Desired Output:
duplicates = ['foo', 'baz', 'bam'];
objects = [
{
name: 'bar',
nums: [3,2]
},
{
name: 'bum',
nums: [2,3]
}
]
Can anyone help with this? I am using lodash in my project.