Skip to content

Instantly share code, notes, and snippets.

@sAbakumoff
Created October 7, 2016 14:02
Show Gist options
  • Save sAbakumoff/e2f78931adcccf0585f196e8c5862261 to your computer and use it in GitHub Desktop.
Save sAbakumoff/e2f78931adcccf0585f196e8c5862261 to your computer and use it in GitHub Desktop.
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(callback, thisArg) {
if (this === null) {
throw new TypeError('Array.prototype.forEach called on null or undefined');
}
if (typeof callback !== "function") {
throw new TypeError(callback + ' is not a function');
}
var len = this.length || 0;
for(var i=0; i<len;i++){
callback.call(thisArg, this[i], i, this);
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment