Given the following array of objects:
var files = [{
name: "test1",
size: 123
}, {
name: "test1",
size: 456
}, {
name: "test2",
size: 789
}]
If I wanted a new array without the object with the name "test1" and the size 123 the following makes sense to me:
_.filter(files, function(_file) {
return _file.name !== "test1" && _file.size !== 123;
});
However; this always removes both items with the name "test1". The following returns the desired results:
_.filter(files, function(_file) {
return _file.name !== "test1" || _file.size !== 123;
});
How come?