Skip to content

Instantly share code, notes, and snippets.

@n3ps
Created July 20, 2021 18:49
Show Gist options
  • Select an option

  • Save n3ps/d672aed3635654f42f9343bdee02645f to your computer and use it in GitHub Desktop.

Select an option

Save n3ps/d672aed3635654f42f9343bdee02645f to your computer and use it in GitHub Desktop.
Array range
function range (start, stop) {
const len = stop - start + 1
return Array(len).fill().map((_, i) => start + 1)
}
// Usage
range(10, 12) // [10, 11, 12]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment