Javascript Array find(fn)
Array.prototype.find = function(fn) { for ( var i = 0; i < this.length; i++ ) { if ( fn(this[i]) === true ) { return this[i]; }/*from w w w . j a v a 2 s . c o m*/ } return undefined; };
Array.prototype.find = function(fn) { for (var i = 0; i < this.length; i++) { if(fn(this[i])){ return this[i]; }//from www .j a v a2 s. c om } return undefined; }