Skip to content

Instantly share code, notes, and snippets.

@hendriklammers
Created March 15, 2013 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hendriklammers/5168143 to your computer and use it in GitHub Desktop.
Save hendriklammers/5168143 to your computer and use it in GitHub Desktop.
Javascript: forEach polyfill
if ( !Array.prototype.forEach ) {
Array.prototype.forEach = function(fn, scope) {
for(var i = 0, len = this.length; i < len; ++i) {
fn.call(scope, this[i], i, this);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment