97
rated 0 times
[
98]
[
1]
/ answers: 1 / hits: 37424
/ 8 Years ago, wed, november 2, 2016, 12:00:00
I have array of different objects which look like this:
[{
color:'red',
'type':'2',
'status':'true'
}
{
color:'red',
'type':'2',
'status':'false'
}]
I want to filter the one element like status
and then count the filtered, for example if status is false then return 1.
I have tried the below code but I am not sure what I am doing here:
for (i = 0; i < check.length; i++) {
var check2;
console.log(check[i].isApproved);
(function(check2) {
return check2 = check.filter(function(val) {
return val == false
}).length;
})(check2)
console.log('again Rides',check2);
}
More From » arrays