Javascript Array index(val)

Description

Javascript Array index(val)


Array.prototype.index = function(val) {
  for(var i = 0, l = this.length; i < l; i++) {
    if(this[i] == val) return i;
  }//  ww w.  ja v  a 2 s. co m
  return null;
};



PreviousNext

Related