Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created February 8, 2018 06:26
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 goofmint/9416aea3652eee144ab00415d7b8474f to your computer and use it in GitHub Desktop.
Save goofmint/9416aea3652eee144ab00415d7b8474f to your computer and use it in GitHub Desktop.
Array.prototype.eachWithIndex = function* () {
for (let i = 0; i < this.length; i += 1) {
yield {index: i, value: this[i]};
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment