Here you can find the source of any(p)
Array.prototype.any = function (p) { for(var i = 0; i < this.length; i++){ if(p(this[i])) return true; }/*from www .j a va2 s. c o m*/ return false; }; function isGreaterThanZero (num) { return num > 0; } function isLessThanZero (num) { return num < 0; } console.log([-1, 2, 3].any(isGreaterThanZero)); // true console.log([-1, -2, -3].any(isGreaterThanZero)); // false
Array.prototype.any = function(delegate) { for (var i=0; i < this.length; i++) { if (delegate.apply(this, [this[i]]) === true) { return true; return false; };
Array.prototype.any = function (func) { var length = this.length; for (var i = 0; i < length; i++) { if (func(this[i])) return true; return false;
Array.prototype.any = function (p) { var count = 0 for (var i = 0 ; i < this.length ; i++) { currentIndex = this[i] if (p(currentIndex) === true) { console.log(p(currentIndex),"true is true") count +=1 }; if (count > 0) { return true return false }; Array.prototype.any = function (p) { return this.filter(p).length > 0; };
Array.prototype.any = function(p) { var count = 0 for (var i = 0; i < this.length; i++) { currentIndex = this[i] if (p(currentIndex) === true) { console.log(p(currentIndex), "true is true") count += 1 }; if (count > 0) { return true return false }; function isGreaterThanZero(num) { return num > 0; function isLessThanZero(num) { return num < 0;
Array.prototype.any = function (p) { for (var i = 0; i < this.length; i++) { if(p(this[i]) == true){ return true; }; return false; };
Array.prototype.any = function (p) { return this.filter(p).length > 0; };
Array.prototype.any = function (p) { for (i = 0; i < this.length; i++) if (p(this[i])) return true; return false; };
Array.prototype.any = function (p) { for(let el of this){ if(p(el)) {return true;} return false; };
Array.prototype.any = function (p) { for (var i = 0; i <this.length; i++){ if (p(this[i]) === true){ return true; return false; };