Skip to content

Instantly share code, notes, and snippets.

@sumardi
Created January 5, 2014 17:13
Show Gist options
  • Save sumardi/8270911 to your computer and use it in GitHub Desktop.
Save sumardi/8270911 to your computer and use it in GitHub Desktop.
Array.prototype.countCattle = function(type) {
var count = 0;
for(var i = 0; i < this.length; i++) {
if (type == this[i].type) {
count++;
}
}
return count;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment