Skip to content

Instantly share code, notes, and snippets.

@Atinux
Last active October 4, 2017 09:25
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 Atinux/e9d33d1bea42a0e8002765283ea5a6b8 to your computer and use it in GitHub Desktop.
Save Atinux/e9d33d1bea42a0e8002765283ea5a6b8 to your computer and use it in GitHub Desktop.
Simple prototype of forEach
Array.prototype.forEach = function (callback) {
// this represents our array
for (let index = 0; index < this.length; i++) {
// We call the callback for each entry
callback(this[index], index, this)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment