Skip to content

Instantly share code, notes, and snippets.

@codyogden
Last active September 2, 2016 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codyogden/827905eebf6242f597748330d550b3fb to your computer and use it in GitHub Desktop.
Save codyogden/827905eebf6242f597748330d550b3fb to your computer and use it in GitHub Desktop.
Return count of objects in array with a specific key & value.
var countItemInObject = function ( arr, item, search ) {
return arr.filter(function( obj ){
return obj[item] === search;
}).length;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment