Skip to content

Instantly share code, notes, and snippets.

@goldhand
Created January 30, 2016 17:52
Show Gist options
  • Save goldhand/83f5bcc817f5e7d1783b to your computer and use it in GitHub Desktop.
Save goldhand/83f5bcc817f5e7d1783b to your computer and use it in GitHub Desktop.
How to create an array in javascript similar to python's range function
Array.from(Array(5).keys());
// -> [0, 1, 2, 3, 4]
// Array(5)
// -> [ , , , , ]
// the values are empty but the keys will increment so we create another array from this array's keys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment