Skip to content

Instantly share code, notes, and snippets.

@Woodsphreaker
Last active December 22, 2017 17:39
Show Gist options
  • Save Woodsphreaker/997d25ac28755cebe346f4b3ac86bd1d to your computer and use it in GitHub Desktop.
Save Woodsphreaker/997d25ac28755cebe346f4b3ac86bd1d to your computer and use it in GitHub Desktop.
range.js
const range = (start = 0, end = 1) => Array.from({"length": (end + 1) - start}, (_, i) => start + i)
console.log(range(-10, 10)); // [ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment