Reputation: 5622
I am filtering an array using .filter
, for example:
stack_wr = stack_wr.filter(function(obj2) {
return obj2.class != sec__id;
});
The above code works perfectly as I require. My question is can I filter using two comparisons or return
statements? One with obj2.class != sec__id
which I have already done and again with obj2.type != whatever_value
or do I have to filter two times like the way I have done below:
stack_wr = stack_wr.filter(function(obj2) {
return obj2.class != sec__id;
});
stack_wr = stack_wr.filter(function(obj2) {
return obj2.type != whatever_value;
});
Upvotes: 1
Views: 31
Reputation: 24001
did you try
stack_wr.filter(function(){
return this.className !== 'email' && this.type !== 'password';
});
Upvotes: 1