Podkreśnij tablicę filtrów JS obiektów
var arr = [1, 2, 3, 4, 5, 6];
var result = _.filter(arr, function(num){
return num % 2 == 0;
});
//output : [2, 4, 6]
Tiny Coders
var arr = [1, 2, 3, 4, 5, 6];
var result = _.filter(arr, function(num){
return num % 2 == 0;
});
//output : [2, 4, 6]
var evens = _.filter([{key: 1}, {key:2}, {key:3}, {key:4}, {key:5}, {key:6}], function(num){ return num.key % 2 == 0; });
=> [2, 4, 6]