Javascript Array valueCount(value)
Array.prototype.valueCount = function (value) { var count = 0;/* www . j a va2 s . c om*/ for( var i = 0; i < this.length; i++) { if ( this[i] === value) { count++; }; }; return count; };