const storage = [ { data: '1', status: '0' }, { data: '2', status: '0' }, { data: '3', status: '0' }, { data: '4', status: '0' }, { data: '5', status: '0' }, { data: '6', status: '0' }, { data: '7', status: '1' }, ]; const count = storage.filter(function(item){ if (item.status === 0) { return true; } else { return false; } }).length; // 6
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter