On a modern browser, you can use the native filter
:
fruitsCollection.filter(function(fruit) {
return fruitsToCut.indexOf(fruit.type) === -1;
} );
Otherwise, you can use the underscore filter in pretty much the same way:
_.filter( fruitsCollection, function(fruit) {
return !_.contains(fruitsToCut, fruit.type);
} );
Also, your fruit names need to be quoted:
fruitsCollection = [ {name: 'papaya', type: 'egzotic'},
{name: 'orange', type: 'citrus'},
{name: 'lemon', type: 'citrus'}
];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…