Javascript Array inArrayIdx(value)

Description

Javascript Array inArrayIdx(value)

Array.prototype.inArrayIdx = function (value) {
 for (var i=0; i < this.length; i++) {
  if (this[i] === value) {
   return i;/*w  ww.  j  a  v a2s.  c  om*/
  }
 }
 return -1;
};



PreviousNext

Related