Skip to content

Instantly share code, notes, and snippets.

@eddieantonio
Last active October 8, 2015 15:16
Show Gist options
  • Save eddieantonio/8ece9dfa9c8a237b484f to your computer and use it in GitHub Desktop.
Save eddieantonio/8ece9dfa9c8a237b484f to your computer and use it in GitHub Desktop.
Allows for `for (let i of 10) { ... }`
Number.prototype[Symbol.iterator] = function* () {
for (let i = 0; i < this; i++) {
yield i;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment