Javascript Array indexOfSelect(filter)
Array.prototype.indexOfSelect = function(filter) { for (var i = 0; i< this.length; i++) { if(filter(this[i])){ return i;/*from w w w. j a va 2s . c om*/ } } return -1; }