Last active
October 6, 2015 15:07
-
-
Save qubyte/91309d5a96917bd6696e to your computer and use it in GitHub Desktop.
Simple python-like range function for ES2015. Requires at least start and stop parameters, and takes an optional step parameter.
This file contains hidden or 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
function* range(start, stop, step = 1) { | |
for (let n = start; n < stop; n += step) { | |
yield n; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use this to do such things as: