Is there a way to remove an object from an array if a single property in that object is found in another object in that array?
const arr = [{
car: 'bmw',
notimportant: 'bla bla',
},{
car: 'audi',
notimportant: 'bli bli',
},{
car: 'bmw',
notimportant: 'ble ble',
},{
car: 'golf',
notimportant: 'blo blo',
}]
Also I would like to add a counter of how many duplicates there were
Expected result:
[{
car: 'bmw',
count: 1,
notimportant: 'bla bla',
},{
car: 'audi',
count: 0,
notimportant: 'bli bli',
},{
car: 'golf',
count: 0,
notimportant: 'blo blo',
}]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…