Here you can find the source of firstOrNull()
Array.prototype.firstOrNull = function () { if (this.length > 0) { return this[0]; }// w w w .j a v a 2 s .co m return null; }
Array.prototype.firstOrNull = function(predicate){ var tmp = this.filter( (function(){ var first = true; return function(item){ if(!first) return false; if(predicate(item)){ first = false; return true; ...