js array return number of items with certain value code example
Example 1: return an object from an array javascript
myArray.find(item => item.isAstronaut)
Example 2: javascript count number of occurrences in array of objects
var result = array.reduce( (acc, o) => (acc[o.name] = (acc[o.name] || 0)+1, acc), {} );