Skip to content

Instantly share code, notes, and snippets.

@oharsta
Created March 22, 2024 13:43
Show Gist options
  • Save oharsta/63415e09430d742ae9ab7c83b612515a to your computer and use it in GitHub Desktop.
Save oharsta/63415e09430d742ae9ab7c83b612515a to your computer and use it in GitHub Desktop.
JS range
const range = (start, end, includeEnd=false) => Array.from({ length: end - start + (includeEnd ? 1 : 0) }, (_, i) => i + start);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment