using underscore’s “difference” method on arrays of objects

try this on for size for finding the difference of an array of objects:

var test = [{a: 1},{b: 2}];
var test2 = [{a: 1}];

_.filter(test, function(obj){ return !_.findWhere(test2, obj); });

Leave a Comment