Here you can find the source of countWhere(xAndY)
//Counts amount of items in array that follow a particular pattern. //call like this: //myArray.countWhere(function(item)){return item.x is something && item.y is something;} //// w ww.j a v a 2 s .c o m Array.prototype.countWhere = function(xAndY){ var count = 0; for(var i = 0; i < this.length; i++) { if(xAndY(this[i])){ count++; } } return count; }
Array.prototype.countWhere = function(xAndY){ var count = 0; for(var i = 0; i < this.length; i++) if(xAndY(this[i])){ count++; return count; ...