Nodejs Array Each each(iterationFunction)

Here you can find the source of each(iterationFunction)

Method Source Code

Array.prototype.each = function(iterationFunction) {
    this.eachIndex(function(element, index) {
        iterationFunction(element);/*from  w w w .ja va 2s  .  c  om*/
    });
};

Related

  1. each(func)
    Array.prototype.each = function(func) {
      function each(array, func) {
      for (var i=0; i<array.length; ++i) {
        func.call(array[i], i);
     each(this, func); 
    };
    
  2. each(func)
    Array.prototype.each = function (func) {
      var arr = this;
      for (var i = 0; i < arr.length; i++) {
        func(arr[i]);
    
  3. each(func)
    Array.prototype.each = function(func) {
      for(var i = 0; i < this.length; i++)
        func(this[i]);
    
  4. each(func, scope)
    Array.prototype.each = function(func, scope) {
        for (var index = 0; index < this.length; index++) {
            func.call(scope || this, this[index]);
    };
    
  5. each(handler, context)
    Array.prototype.each = function (handler, context) {
        var size = this.length
        if (typeof context == "undefined") context = this
        for (var i = 0; i < size; i++) {
            if (handler.call(context, this[i], i) == false) break
    
  6. each(iterator)
    Array.prototype.each = function(iterator) {
      for(var i = 0; i < this.length; i++) {
        iterator(this[i], i);
    
  7. each(iterator, context)
    Array.prototype.each = function(iterator, context)
      for(var i = 0, length = this.length >>> 0; i < length; i++)
        if(i in this)
          if(iterator.call(context, this[i], i, this) === false)
            return;
    
  8. each(length, callback)
    Array.prototype.each = function(length, callback) {
      if (typeof length == 'function') {
        callback = length;
        length = this.length;
      for (var i=0; i < length; i++) {
        callback(this[i]);
    };
    ...
    
  9. each(method)
    Array.prototype.each = function(method) {
      for (var i = 0; i < this.length; i++) {
        this[i][method]()