Is array matching any predicate - Node.js Array

Node.js examples for Array:Array Operation

Description

Is array matching any predicate

Demo Code


Array.prototype.any = function(delegate) {    
  for (var i=0; i < this.length; i++) {      
    if (delegate.apply(this, [this[i]]) === true) {
      return true;
    }//from   www . j a  v  a2  s  . c  om
  }      
  return false;  
};

Related Tutorials