Skip to content

Instantly share code, notes, and snippets.

@dshaw
Created April 11, 2010 17:14
Show Gist options
  • Save dshaw/362890 to your computer and use it in GitHub Desktop.
Save dshaw/362890 to your computer and use it in GitHub Desktop.
Array.prototype.forEach implementation from @Rem
// from @rem's dashboard.js: http://rem.im/chirp/dashboard.js
if (![].forEach) {
Array.prototype.forEach = function(fn) {
var len = this.length || 0,
i = 0;
context = arguments[1];
if (typeof fn == 'function') {
for (; i < len; i++) {
fn.call(context, this[i], i, this);
}
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment