7 lines
167 B
JavaScript
7 lines
167 B
JavaScript
Array.prototype.find = function (fun) {
|
|
for (var i = 0, r; i < this.length; i++) {
|
|
if (r = fun.call(this, this[i])) { return r }
|
|
}
|
|
return null;
|
|
};
|