Nodejs Array Each each(callback)

Here you can find the source of each(callback)

Method Source Code

Array.prototype.each = function(callback){
  var count = 0;//from   w  ww.  jav  a  2s  . c o m
  for (var i = 0; i < this.length; i++){
    var el = this[i];
    callback.call(this,el,count);
    count++;
  }
}

Related

  1. each(block)
    Array.prototype.each = function(block){
      for(var i=0;i<this.length;i++)
         block(this[i])
    
  2. each(callback)
    Array.prototype.each = function(callback){
      for(var i = 0; i < this.length; i++){
        callback(this[i]);
    
  3. each(callback)
    Array.prototype.each = function(callback) {
      for (var i = 0;i < this.length;i++) {
        callback(this[i], i);
    };
    
  4. each(callback)
    Array.prototype.each = function(callback){
      if(!callback) return;
      for(var i = 0; i < this.length; i++){
        callback(this[i]);
    
  5. each(callback)
    Array.prototype.each = function(callback)
        for(var i = this.length; -- i >= 0 ;)
            if(false === callback(i,this[i]))
                return;
    
  6. each(callback)
    Array.prototype.each = function(callback) {
      for (var i = 0;i < this.length;i++) {
        callback(this[i], i);
    };
    
  7. each(callback)
    Array.prototype.each = function(callback) {
      for(var i = 0, l = this.length; i < l; i++) {
        callback(i, this[i]);
      return this;
    
  8. each(callback)
    Array.prototype.each = Array.prototype.each || function (callback) {
        var self = this;
        for (var i = 0; i < self.length; i++) {
            var item = self[i];
            callback(i, item);
    
  9. each(callback)
    Array.prototype.each = function (callback) {
      for (var i = 0; i < this.length; i++) {
        callback(this[i]);
      return this;
    };