Javascript Array indexOf(obj)
Array.prototype.indexOf = function(obj) { for (var i = 0; i < this.length; i++) { if (this[i] == obj) return i;/*from w w w . java 2 s . c o m*/ } return -1; };