Last active
September 13, 2021 05:28
-
-
Save jonrandy/b4fc40e4673bee4ed7e56b6518a30287 to your computer and use it in GitHub Desktop.
Spreading Numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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