Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

count array filter javascript

const items = [
  { color:'red', type:'2', status:'true' }, 
  { color:'red', type:'2', status:'false' } 
];

const falseNb = items.reduce((n, e) => e.status === 'false' ? n+1 : n, 0);

console.log(falseNb) // => 1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #count #array #filter #javascript
ADD COMMENT
Topic
Name
3+9 =