Javascript Array some(callback, scope)

Description

Javascript Array some(callback, scope)


// Array.prototype.some
Array.prototype.some = function some(callback, scope) {
  for (var array = this, index = 0, length = array.length; index < length; ++index) {
    if (callback.call(scope || window, array[index], index, array)) {
      break;//from  w  ww. j av a  2 s.com
    }
  }

  return index === length;
};



PreviousNext

Related