Here you can find the source of forEach(cb)
Array.prototype.forEach = function(cb) { for (var i = 0; i < this.length; i++) { cb(this[i]);/* w w w.j a va 2s .com*/ } };
Array.prototype.forEach = Array.prototype.forEach || function (callback) { var self = this; for (var i = 0; i < self.length; i++) { var item = self[i]; callback(item, i, self);
Array.prototype.forEach = Array.prototype.forEach || function (callback, context) { context = context || window; var l = this.length; for (var i = 0; i < l; i++) callback.call(context, this[i], i, this); };
Array.prototype.forEach = function (callback, context) { for (var index in this) { var item = this[index]; if (!callback(index, item, context)) { break; };
Array.prototype.forEach = function (callback, thisArg) { if (typeof callback !== 'function') { throw new TypeError(callback + ' is not a function.'); var len = this.length; for (var i = 0; i < len; i++) { callback.call(thisArg, this[i], i, this); }; ...
Array.prototype.forEach = function(cb){ for(var k in this) cb(this[k]); };
'use strict'; Array.prototype.forEach = function(cb) { for(let i = 0 ; i < this.length ; i++) { cb(this[i]); };
Array.prototype.forEach = function(fn) { for (var i = 0; i < this.length; i++) fn(this[i]);
Array.prototype.forEach=function(fn){ var arr=this; var length=this.length; for(var i=0;i<length;i++){ fn(arr[i],i,arr);
Array.prototype.forEach = function(fn) for (var i=0;i<this.length;i++) fn(this[i]);