Javascript Array count(x)

Description

Javascript Array count(x)


Array.prototype.count = function (x) {
  var c = 0;//w w w .ja va 2 s  .c o m
  for (var i = 0, size = this.length; i < size; i ++)
    if (this[i] == x)
      c ++;
  return c;
};



PreviousNext

Related