Created
January 16, 2020 11:36
-
-
Save mikegoatly/616095a36eebb4b96278e02ef5db21a7 to your computer and use it in GitHub Desktop.
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
function range(start: number, count: number) { | |
function* iterateRange() { | |
for (let i = start; i < count; i++) { | |
yield i; | |
} | |
} | |
return Array.from(iterateRange()); | |
} | |
// E.g. | |
const hours = range(0, 24); | |
const minutes = range(0, 60); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment