Created
October 7, 2016 13:53
-
-
Save sAbakumoff/74358cca0e1647a0a8a4ac59111fb6be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 O = Object(this), len = O.length >>> 0, k = 0, value; | |
if (arguments.length > 1) { | |
value = thisArg; | |
} | |
while (k < len) { | |
if (k in O) { | |
callback.call(value, O[k], k, O); | |
} | |
k++; | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment