Javascript Array foreach(func, context)

Description

Javascript Array foreach(func, context)

Array.prototype.foreach = function(func, context) {
  var len = this.length, i;
  for (i = 0; i < len; i++) {
    if (func.call(context, this[i], i) === false) {
      break;/*from  w  w  w  .j  a  v  a 2s .c  om*/
    }
  }
};



PreviousNext

Related