I have the following problem. I wolud like to filter this fruitsCollection based on fruits array. I would like to be the result was that, for example :
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'}
];