Skip to content

Instantly share code, notes, and snippets.

@cesalberca
Created June 30, 2020 15:33
Show Gist options
  • Save cesalberca/651c3a19d728150d87a98b9635091099 to your computer and use it in GitHub Desktop.
Save cesalberca/651c3a19d728150d87a98b9635091099 to your computer and use it in GitHub Desktop.
Range function that returns an array from a given number to another
export function range(start: number, end?: number): number[] {
return [...Array(end !== undefined ? end - start : start).keys()].map(i => i + (end !== undefined ? start : 0))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment