Skip to content

Instantly share code, notes, and snippets.

@etale
Last active March 16, 2017 03:50
Show Gist options
  • Save etale/81bd22a72efea60a8c17d6622fdce1b8 to your computer and use it in GitHub Desktop.
Save etale/81bd22a72efea60a8c17d6622fdce1b8 to your computer and use it in GitHub Desktop.
an iterator for Number
Reflect.set(Number.prototype, Symbol.iterator, function* () { let i = 0; while (i < this) yield i++ })
@etale
Copy link
Author

etale commented Jan 16, 2017

[ ... 3 ] // => [ 0, 1, 2 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment