さて、あなたはカウントだけで行うことができ、あるいは、あなたは可能性がある:status
は'false'
ノートに等しい要素の数をカウントしますフィルタを実行して、最終配列の長さを取得します。
var count = 0;
var arr = [{color:'red', type:'2', status:'true'},
{color:'red', type:'2', status:'false'} ];
// Showing filterin to be robust. You could just do this in
// a loop, which would be sensible if you didn't need the subarray.
var filtered = arr.filter (function (d) {
// Note that I'm testing for a string, not a boolean, because
// you are using strings as values in your objects.
// If it was a boolean, you'd use if (d.status) { ... }
count++;
return d.status === 'false';
});
// These should be the same, reflecting number of objs with 'false'
console.log (count);
console.log (filtered.length);
// This should trace out a sub array of objs with status === 'false'
console.log (filtered);
さらに説明が必要です。 「フィルタリングされた」という言葉はあまりにも自由に使用されています。これは非常に不明です... –