Last active
September 2, 2016 22:06
-
-
Save codyogden/827905eebf6242f597748330d550b3fb to your computer and use it in GitHub Desktop.
Return count of objects in array with a specific key & value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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