Skip to content

Instantly share code, notes, and snippets.

@mikegoatly
Created January 16, 2020 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikegoatly/616095a36eebb4b96278e02ef5db21a7 to your computer and use it in GitHub Desktop.
Save mikegoatly/616095a36eebb4b96278e02ef5db21a7 to your computer and use it in GitHub Desktop.
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