Skip to content

Instantly share code, notes, and snippets.

@jonrandy
Last active September 13, 2021 05:28
Show Gist options
  • Select an option

  • Save jonrandy/b4fc40e4673bee4ed7e56b6518a30287 to your computer and use it in GitHub Desktop.

Select an option

Save jonrandy/b4fc40e4673bee4ed7e56b6518a30287 to your computer and use it in GitHub Desktop.
Spreading Numbers
Number.prototype[Symbol.iterator] = function* () {
for (let i = 1; i <= this; i++) yield i
}
[...5] // [1,2,3,4,5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment