我有兩個這樣的對象。如何使用Javascript或Lodash從arrayList中刪除特定對象
var find = [{
licenseId: 'A123',
batchId: '123',
name: 'xxx'
},
{
licenseId: 'B123',
batchId: '124',
name: 'yyy'
}];
var result = [
{
licenseId: 'A123',
batchId: '123',
name: 'xxx',
tag: 'college',
sem: 'fourth'
},
{
licenseId: 'B123',
batchId: '124',
name: 'yyy',
tag: 'college',
sem: 'third'
},
{
licenseId: '1111',
batchId: 'C123',
name: 'yyy',
tag: 'college',
sem: 'second'
},
{
licenseId: '3456',
batchId: 'B123',
name: 'yyy',
tag: 'college',
sem: 'second'
}];
我想刪除結果已與所有三個屬性匹配找到對象的對象。我想要的結果應該是這樣的:
[{
licenseId: '1111',
batchId: 'C123',
name: 'yyy',
tag: 'college',
sem: 'second'
},
{
licenseId: '3456',
batchId: 'B123',
name: 'yyy',
tag: 'college',
sem: 'second'
}];
你能協助嗎?
請張貼你的努力 – mplungjan
你確定多麼希望最終結果看起來像嗎?我的意思是你拿一個licenseId並把它作爲一個batchId。最終的結果是,你有一個3456的licenseId,但是這在起始數組中並不存在。 –