Skip to content

Instantly share code, notes, and snippets.

@holmberd
Last active March 24, 2019 19:08
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 holmberd/91562949b39b55fd726ce3e5398ced2b to your computer and use it in GitHub Desktop.
Save holmberd/91562949b39b55fd726ce3e5398ced2b to your computer and use it in GitHub Desktop.
Simple Javascript Range functions

Examples of Javascript simple Range functions.

// range(n)
`const range = n => [...Array(n).keys()];

// range(start, end)
const range = (start, end) => [...Array(end + 1).keys()].slice(start);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment